Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1356506

    In the Auto-response text of the contact form, I have written:

    Hello, you will receive an answer shortly.

    I want the name (field id=”name”) of the user who sent the message to appear after Hello.

    How could I do it?

    #1356579

    Hey Ramiro,

    Thank you for the inquiry.

    Are you trying to prepend the name of the sender to the autoresponsder subject? Please try to use this filter in the functions.php file.

    add_filter("avf_contact_form_autoresponder_mail", function($mail_array, $new_post, $form_params, $class) { 
         $mail_array["Subject"] = "Hello " . $new_post["2_1"];
    
         return $mail_array;
    }, 10, 4);
    

    You may need to adjust the 2_1 with the actual ID of the name field. The number 2 refers to the order of the field in the contact form. So if the name field is the third field in the form, you have to replace 2_1 with 3_1.

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Field id="name" in Auto-response text of the contact form’ is closed to new replies.