Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1368103

    Hi,
    Is it somehow possible to specify Subject which can be configured in Contact Form to contain one of the fields visitor fills?
    Instead of simple subject: “Confirmation Email” it would show “Confirmation Email – Name” where Name would match what visitor provided

    #1368189

    Hi Jaro,

    Please try to add this code in your child theme’s functions.php file:

    add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params) {
    	$subject = $subject . ' - ' . urldecode($new_post['1_1']);
    	return $subject;
    }

    Hope it helps.

    Best regards,
    Nikko

    #1368220

    Nikko,
    Can you please exmplain this code a little?
    How can I configure it to match the field I want displayed? I’m not really sure what to change

    Thanks

    #1368226

    Hi Sovietovic,

    The code basically allows you to modify the subject.
    This line of code is basically where the changing happens.

    $subject = $subject . ' - ' . urldecode($new_post['1_1']);

    $subject is the E-Mail Subject field in the Contact Form.
    urldecode($new_post[‘1_1’]) is the first field where the name field usually is.
    You can right-click and inspect the form field in your browser and the first field (name field) has this name attribute avia_1_1 and you can access the value using $new_post[‘1_1’]. The next element is avia_2_1, avia_3_1 and so on.

    Best regards,
    Nikko

    #1368245

    Thanks Nikko for detailed explanation. Feel free to close this thread :)

    #1368247

    Hi Sovietovic,

    We’re glad that we could help you :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Could contact form email subject contain field value’ is closed to new replies.