Sauter la navigation

[Résolu] How to ad a text from an user form custom field in the form notification

This support ticket is created Il y a 2 années et 11 mois. There's a good chance that you are reading advice that it now obsolete.

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.

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par jeanL-2 Il y a 2 années et 11 mois.

Auteur
Publications
#2274913

Tell us what you are trying to do?

I have added a custom field 'structure' to the user registration form. I want the notification sent after validation of the current form to contain the text from this custom field.

Is there any documentation that you are following?
https://toolset.com/forums/topic/how-to-add-custom-fields-in-a-notification-email-linked-to-user-form/

Is there a similar example that we can see?

Here is the custom field in the form in html :

<div class="form-group col-md-6">
<label for="%%FORM_ID%%_structure">[cred_i18n name='structure-label']Nom de la structure[/cred_i18n]</label>
[cred_field field='structure' force_type='field' class='form-control' output='bootstrap']
</div>

Here is the code I put in functions.php :

add_filter('cred_body_notification_codes', 'func_merge_custom_notification_placeholder', 10, 1);
function func_merge_custom_notification_placeholder($defaultPlaceHolders) {
return array_merge($defaultPlaceHolders, array('%%STRUCTURE%%' => $_REQUEST['structure']));
}

And the short code I tried without success:

%%STRUCTURE%% and [types field='field' item='%%STRUCTURE%%'][/types]

#2275163

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi there

You shouldn't need any custom code to output a custom field that is included in the form.

But for a user form, you will need to add the argument user_id="%%USER_USERID%%"

See https://toolset.com/course-lesson/send-notifications-when-someone-submits-the-form/#displaying-post-and-user-fields-in-notifications

#2275437

My issue is resolved now. Thank you!