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

    Hello,

    we use a normal enfold avia form with a selection field. Now we want to use the selected value of the selectionfield for the subject for the emails which will be send.

    I found this code here in another thread

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

    But for this code i got a fatal error on the php side. Can you plz help us with this task?

    thanks
    Chris

    #1339219

    Hey Chris_85,
    Please give this a try:

    add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params) {
    $subject = sprintf("%s", $new_post['5_1']);
    return $subject;
    }

    this assumes that the fifth field in the contact form is a select field:
    2022-02-06_006.jpg
    note that any spaces in the field will be replaced with %20 so use an underline or dash
    2022-02-06_007.jpg

    Best regards,
    Mike

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.