Anonymous User 18525946
(@anonymized-18525946)
Hey there, @spay18 👋
Absolutely! You can type anything you want in the ‘Email display name’ input — including spaces and emojis. A first and last name is a great choice.
I hope this helps clear things up!
Thread Starter
spay18
(@spay18)
Hi Scott, the first and last name should appear that the user compiles the contacts module. I can’t know before. Is there any code to enter? Example [name] [surname]
Thank you
I see, @spay18!
In that case, you’ll need a PHP customization. If you’re okay copy-pasting code to your functions.php file, we’ll be glad to share a ready-made snippet. In that case though, would you share a link to your form, and point us to the “name” and “surname” fields, so we can tweak our snippet before sharing it with you?
Let us know!
Thread Starter
spay18
(@spay18)
Hi Ignazio,
here is the link with the contact form: https://www.selleriaequipe.it/contatti/
I await the code
Thank you
Perfetto, @spay18! 😉
Try this snippet:
function happyforms_custom_email_alert( $email_message ) {
$subject = $email_message->get_subject();
$form_id = $email_message->message['form_id'];
$form = happyforms_get_form_controller()->get( $form_id );
$parts = wp_list_pluck( $form['parts'], 'id', 'label' );
$message_parts = $email_message->message['parts'];
$name_label = 'Nome *';
if ( isset( $parts[$name_label] ) ) {
$name_value = $message_parts[$parts[$name_label]];
$subject .= ' — ' . $name_value;
}
$surname_label = 'Cognome *';
if ( isset( $parts[$surname_label] ) ) {
$surname_value = $message_parts[$parts[$surname_label]];
$subject .= ' ' . $surname_value;
}
$email_message->set_subject( $subject );
return $email_message;
}
add_filter( 'happyforms_email_alert', 'happyforms_custom_email_alert' );
That should hopefully do the trick. Let us know how it goes!
Anonymous User 18525946
(@anonymized-18525946)
How did that snippet work out, @spay18? Do you need any more help here?
Anonymous User 18525946
(@anonymized-18525946)
I’m going to close this thread. If you still need a hand, please let us know in a new thread 🙂
Thread Starter
spay18
(@spay18)
Hi Scott,
unfortunately the code generated an error 🙁