Tagged: 

Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • #431916

    Hi!

    Is there a way to get a custom email subject line from the form ?

    We have a booking form, and we want to get some data that is entered in the form into the email subject line.

    Is that possible ?

    #432420
    #432425

    Hi Elliot!

    Thanx, but isn’t that the same as changing the subject line to a “static” one in the forms option, if left blank the subject line will be the default.

    What i want to achieve is to have the subject line change depending on what is entered in the form. I.E have the name entered in the form incorporated in the email subject line.

    Since the subject line is the same when we get them from the form it’s hard to separate the mails, or connect them to a certain client by just looking at the subject line.

    Thanx

    #433006

    Hi!

    I haven’t tested it out but here is an example doing that, https://kriesi.at/support/topic/mail-subject/.

    Here is another example, https://kriesi.at/support/topic/problem-with-contact-form-3/.

    Regards,
    Elliott

    • This reply was modified 9 years, 8 months ago by Elliott.
    #433311

    Thanx Elliot but i read those and tried them both but still get a empty subject line ?

    It would be a lifesaver if we could get this to work!

    Thanx

    #434252

    Hi!

    Your sure your using the correct label? https://kriesi.at/support/topic/mail-subject/#post-138438

    Paste the code your using here.

    Cheers!
    Elliott

    #435125

    Hi i think i have the label correct.

    The field i want to be the subject line from the form is the first “företag”

    http://paullindqvist.se/gb/foretagspaket/

    Code i pasted into the functions.php

    add_action( 'wp_head', 'insert_fb_in_head', 5 );
    
    add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params)
    {
    $subject = $form_params['företag'];
    return $subject;
    }
    #436164

    Hey!

    That’s not the same code as Dude posted in the link I provided. Are you just trying to change the subject to “fortag”? If so then it would look like this.

    add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params)
    {
    $subject = 'företag';
    return $subject;
    }

    Best regards,
    Elliott

    #436172

    Hi Elliot correct i mixed the posts up.

    I now tried the code at the bottom of the page you linked to.

    add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params)
    {
    $subject = urldecode($new_post['företag_'.(avia_form::$form_id - 1)]);
    return $subject;
    }

    Still get a blank subject on the emails ?

    Thanx!

    #436866

    Hi!

    I’m not sure. Perhaps the umlaut is causing problems. I would try looking into the contact form 7 or gravity forms plugins to see if they have this feature.

    Regards,
    Elliott

    #436914

    What is the Umlauts ?

    Is there any chance Dude can take a look and see why it’s not working ?

    Would be great if i could get this working!

    Thanx!

    #438159

    Hey!

    The umlaut is the o in fortag. Or maybe I’m using the wrong term.

    I’ll go ahead and flag this for the rest of our team to see if they have any idea.

    Best regards,
    Elliott

    #438426

    Oh i then i understand, i tried another field in the form, with no success.

    Thanx!

    #441595

    Hi!

    Go ahead and send us a WordPress login and we’ll take a closer look.

    Regards,
    Elliott

    #441719
    This reply has been marked as private.
    #442531

    Hi!

    I do not see the code in your functions.php file. Where did you add it?

    Cheers!
    Elliott

    #442539
    This reply has been marked as private.
    #445045

    Hey!

    Try it out now.

    Best regards,
    Elliott

    #445098
    This reply has been marked as private.
    #445118

    I saw the difference in the functions, copied it and it worked great! Thanx!!

    Final question, is it possible to add a static text that will work in conjunction with the “foeretag” form label ?

    Like “booking from “foeretag”

    Regardless, thank you so much for the help!!

    #445812

    Hi!

    Yes, it would look something like this.

    $subject = "booking from " . urldecode($new_post['företag_'.(avia_form::$form_id - 1)]);
    

    And make sure “foretag” is using the correct ID that I set before.

    Cheers!
    Elliott

    #445820

    Wow thank you! Worked perfectly!

    Really appreciate the help!

    Regards
    Paul L.

Viewing 22 posts - 1 through 22 (of 22 total)
  • The topic ‘Form email subject line’ is closed to new replies.