• Resolved viewsmarketing

    (@viewsmarketing)


    Hello,

    is there meanwhile a possibility to use form data (e.g. first name, last name) in the happyforms confirmation email?

    Greetings Natalie

Viewing 8 replies - 1 through 8 (of 8 total)
  • Anonymous User 18525946

    (@anonymized-18525946)

    Hey there, @viewsmarketing ??

    Over in the Email tab, under “Email respondent a copy of their submission”, be sure to enable “Include submitted values”. Doing this will include all the respondent’s answers in the confirmation email.

    We don’t yet have a way to include specific answers in email messages (e.g. “Thank you, @first_name”). That’s on our to-do list for later this year.

    By the way, this forum is for our free users. As a paying customer, please email ask[at]happyforms[dot]io — we can help you out much faster there.

    • This reply was modified 2 years, 6 months ago by Anonymous User 18525946.
    • This reply was modified 2 years, 6 months ago by Anonymous User 18525946.
    Thread Starter viewsmarketing

    (@viewsmarketing)

    Hi Scott,

    thank you very much for your reply. I obviously expressed myself inaccurately. I would like to enter in “Receive a copy of each submission via email” in the “Displayed email sender name” field, the last name and first name from the fields that the sender has populated with their information.

    Is this possible?

    Best regards
    Natalie

    Ignazio Setti

    (@ignaziohappyforms)

    Got it, @viewsmarketing!

    As mentioned by Scott, this isn’t possible out of the box yet, sorry! If you’re okay copy-pasting a bit of custom code though, it’s definitely doable with a simple snippet, and we’d be glad to provide a ready made one.

    Let us know!

    Anonymous User 18525946

    (@anonymized-18525946)

    Just checking in here, @viewsmarketing. Would you like to try the code snippet?

    We can walk you through the steps. It’s less scary than it sounds ??

    Just let us know!

    • This reply was modified 2 years, 6 months ago by Anonymous User 18525946.
    Thread Starter viewsmarketing

    (@viewsmarketing)

    Hi,

    yes, I would love to try the code snippet!

    Best regards
    Natalie

    Ignazio Setti

    (@ignaziohappyforms)

    Hey @viewsmarketing ??

    Sorry it took so long to come back to you. Here’s the snippet — you can either copy-paste it at the bottom of your child theme functions.php file, or use a plugin like Code Snippets:

    add_filter( 'happyforms_email_alert', function( $email_message ) {
        $first_name_label = 'First name';
        $last_name_label = 'Last name';
    
        $from_name = $email_message->get_from_name();
        $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'];
        
        if ( isset( $parts[$first_name_label] ) ) {
            $from_name = $message_parts[$parts[$first_name_label]];
        }
    
        if ( isset( $parts[$last_name_label] ) ) {
            $from_name .= ' ' . $message_parts[$parts[$last_name_label]];
        }
        
        $email_message->set_from_name( $from_name );
    
        return $email_message;
    } );

    Just make sure to tweak lines 2 and 3, so that they match your “first name” and “last name” field labels.

    Let us know how that goes!

    Anonymous User 18525946

    (@anonymized-18525946)

    How did that go, @viewsmarketing? Did that do the trick?

    Anonymous User 18525946

    (@anonymized-18525946)

    I’ll close this thread. If you still need a hand, please reach out in a new topic.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘form data in confirmation email’ is closed to new replies.