Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #592394

    I would like to have something like the issue that was brought up in this old post from 2013:

    https://kriesi.at/support/topic/mail-subject/

    When a visitor sends a message using the contact form, the default subject is “New Message (sent by contact form at ******)” in the email that we receive. Is it possible to change this? I have a field called Subject in the contact form, when a visitor writes a subject of their mail I would like that to be shown instead of the default.

    We’ve tried altering the functions.php with the code suggested there:

    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['subject_'.(avia_form::$form_id - 1)]);
    return $subject;
    }

    But clearly that code no longer works with the way the new Contact Form is set up.

    Can someone help with an updated solution?

    #593555

    Hey reynoldsphobia!

    To customize the subject please check https://kriesi.at/support/topic/mail-subject/#post-138433

    To customize other email messages add the below code in your functions.php by going to appearance > Editor > functions.php

    Please use a child theme so your changes remain intact when you update the main theme.

    kriesi.at/documentation/enfold/using-a-child-theme/

    
    
    add_filter('avf_mailchimp_messages', 'avf_mailchimp_messages_mod', 10, 1);
    function avf_mailchimp_messages_mod($message) {
        $message['email'] = __('Please provide a valid email address.', 'avia_framework');
        $message['all'] =__('Please fill in all required fields.', 'avia_framework');
        $message['already'] =__('This email address is already subscribed, thank you!', 'avia_framework');
        $message['general'] =__('We are very sorry but something went wrong. Please try again later.', 'avia_framework');
        $message['invalid_field'] =__('Please make sure that your fields are filled in correctly', 'avia_framework');
    
        return $message;
    }

    Cheers!
    Vinay Kashyap

    #594622

    Thank Vinay, but this is not about the Mailchimp widget. This is instead about the standard Contact Form Content Element.

    The thread you reference above as a solution to the subject line issue (that the subject field on the sent email from the contact form does not pull the subject text from the subject field in the form):

    To customize the subject please check https://kriesi.at/support/topic/mail-subject/#post-138433

    is the exact same thread that I reference in my initial post, explaining that the solution (from 2013) no longer works with the current Contact Form Content Element. I’m looking for a solution to the current version (Enfold 3.4.7).

    Thanks.

    #597166

    Hey!

    The label identifier has been removed to prevent conflict on complex forms. Please replace the code with this:

    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['avia_3_1']);
    return $subject;
    }

    Regards,
    Ismael

    #597227

    Thanks, Ismael, but this just returns emails with “(no subject)” in the subject line.

    #597610

    Hi!

    Did you fill in the Subject field in the contact form? http://nevermindgame.com/hello/

    Cheers!
    Ismael

    #597621

    Hi!

    UPDATE: Please replace the code in the functions.php file with this:

    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['3_1']);
    return $subject;
    }

    Best regards,
    Ismael

    #602302

    Thank you so much, Ismael! That seems to have done the trick with the adjustment in the third line of code!

    Many thanks! I know there are several support threads out there regarding this issue, so hopefully this will help someone else as well!

    #603597

    Hi!

    Glad we could help you. Enjoy the theme and feel free to come back with further questions and/or problems you have. Simply open a new thread.

    Cheers!
    Günter

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Email Subject from Contact Form Subject’ is closed to new replies.