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
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
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
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
Thanks Nikko for detailed explanation. Feel free to close this thread :)
Hi Sovietovic,
We’re glad that we could help you :)
Thanks for using Enfold and have a great day!
Best regards,
Nikko