Tell us what you are trying to do?
I have created a notification for a new user registration form.
I want to use the form field - "user_firstname" to display in the email
and a generic field.
I have tried %%first_name%%
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Mario,
Thank you for getting in touch.
Could you try this ?
[wpv-user field="user_firstname"]
Or
%%USER_FIRSTNAME%%
Please let me know if this helps.
Thanks,
Shane
Hi Shane
Tried both - nothing displays.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Mario,
Thank you for trying.
Would you mind allowing me to have admin access to the website so that I can check on this for you ?
The private fields will be enabled for your next response.
Also please let me know the page where i can find the form to test.
Thanks,
Shane
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Mario,
Thank you for the patience.
I've done some testing on your site and you will need to create custom markers for your notifications.
For e.g i've created a custom marker for first name which is %%FIRST_NAME%% using this code below.
add_filter('cred_subject_notification_codes', 'custom_generic_field_notification', 10, 1);
add_filter('cred_body_notification_codes', 'custom_generic_field_notification', 10, 1);
function custom_generic_field_notification( $defaultPlaceHolders ) {
$newPlaceHolders = array(
'%%FIRST_NAME%%' => $_REQUEST['first_name']
);
return array_merge($defaultPlaceHolders, $newPlaceHolders );
}
To add lets say last name we can do it like this.
add_filter('cred_subject_notification_codes', 'custom_generic_field_notification', 10, 1);
add_filter('cred_body_notification_codes', 'custom_generic_field_notification', 10, 1);
function custom_generic_field_notification( $defaultPlaceHolders ) {
$newPlaceHolders = array(
'%%FIRST_NAME%%' => $_REQUEST['first_name'],
'%%LAST_NAME%%'=>$_REQUEST['last_name'],
);
return array_merge($defaultPlaceHolders, $newPlaceHolders );
}
Where last_name is the name of the field on the form.
I've tested this and it works.
Please let me know if this helps.
Thanks,
Shane
H Shane,
Tried both the suggested solutions, unfortunately crashes the site.
I placed the code in the plugin my custom functions.
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Mario,
You won't need to re-add the function to the function.php file. I've already added the custom function to the Toolset custom functions in Toolset->settings->custom code.
All you need to do is to modify this code and add the other placeholders.
Thanks,
Shane
Hi Shane,
Thank you for the assistance.