Home › Toolset Professional Support › [Resolved] Notification to specific e-mail address with custom field value in Message Body
Problem: I would like to use the value of a User Form custom field as the email destination for a Forms notification.
Solution: Access the custom field value using the User ID placeholder:
[types usermeta='mesto-obec' user_id='%%USER_USERID%%'][/types]
Relevant Documentation:
https://toolset.com/documentation/user-guides/cred-user-forms-email-notifications/#inserting-the-user-login-information-fields
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Tagged: Toolset Forms, User-registration forms
Related documentation:
This topic contains 4 replies, has 2 voices.
Last updated by jiriK-2 6 years, 3 months ago.
Assisted by: Christian Cox.
Hello,
I've build Toolset User Form following your documentation.
Now I need to send a Notification e-mail message to a specific e-mail address (not any user's email address) with custom fields.
So for instance in Content User Form I have my Custom field e. g.:
<div class="form-group">
<label>Město, obec</label>
[cred_field field='mesto-obec' value='' urlparam='' class='form-control' output='bootstrap']
</div>
and now I need send sent a value of this field in Notification mail body to a specific email address.
I was trying to use:
[wpv-post-field name='mesto-obec'] - not working
[types usermeta='mesto-obec'][/types] - not working
[types usermeta='mesto-obec' user_is_author='true'][/types] - not working
Please let me know how to display the field's content properly.
Thanks, best,
Jiri.
Hi, try adding the new User ID to the Types field shortcode like this:
[types usermeta='mesto-obec' user_id='%%USER_USERID%%'][/types]
That should give you access to the custom field value in a notification.
https://toolset.com/documentation/user-guides/cred-user-forms-email-notifications/#inserting-the-user-login-information-fields
Dear Christian,
perfect, it is working now, thank you very much!
The last issue:
I also use these 2 default user fields:
<label>Jméno</label>
[cred_field field='first_name' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>
<div class="form-group">
<label>Příjmení</label>
[cred_field field='last_name' post='user' value='' urlparam='' class='form-control' output='bootstrap']
</div>
and theis value's displaying is not working in your suggested way:
[types usermeta='first_name' user_id='%%USER_USERID%%'][/types]
[types usermeta='last_name' user_id='%%USER_USERID%%'][/types]
Please how to display them properly in Notification mail body to a specific email address?
Many thanks!
Jiri
There aren't built-in placeholders for first and last name, but you can add this custom code to your child theme's functions.php file to activate custom placeholders:
add_filter('cred_body_notification_codes', 'custom_generic_field_notification'); add_filter('cred_subject_notification_codes', 'custom_generic_field_notification'); function custom_generic_field_notification( $defaultPlaceHolders ) { $newPlaceHolders = array( '%%FORCED_FIRST%%' => $_REQUEST['first_name'], '%%FORCED_LAST%%' => $_REQUEST['last_name'], ); return array_merge($defaultPlaceHolders, $newPlaceHolders ); }
Then in the notification you can use the placeholders %%FORCED_FIRST%% and %%FORCED_LAST%% to display the first and last name.
Dear Christian,
great, everything is working fine now, thanks for your help! 🙂
Jiri