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

    Here is another one issue:

    I have several Enfold contact forms on my pages. Each of them should send autoresponder message when form is submitted.

    The thing is that Subject of those messages should be different for every form, depending which one is submitted. For example, when reservation is sent, AR message should have subject “Thank you for your reservation”, when request is sent “Your request”, when message is sent “Thank you for your message”, etc.

    Another thing is that all of those forms are in two languages, so this customized subject should change depending on from what page is sent.

    Right now, all of those messages have same title: “Thank you for your message”. I translated that in de_DE.po file to German and, when sent from German pages it is in correct language.

    I thought that field E-Mail Subject when creating contact form is subject of autoresponder mail for customer, but instead, it is title of mail that is sent to administrator.

    It would be great to add this E-Mail Subject field for AR messages that are sent to user in some future version of Enfold.

    Thank you,

    Ivan

    #515329

    Hi Simijonovic!

    Thanks for the request. Please consider adding it here, https://kriesi.at/support/enfold-feature-requests/.

    Cheers!
    Elliott

    #515337

    Hi Elliott,

    I will submit feature request for sure.

    Could you please tell me if there is any solution for this? I found several posts with similar topic, and solutions:

    add_filter(‘avf_form_subject’,’avia_change_mail_subject’, 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params)
    {
    $subject = $form_params[‘subject’];
    return $subject;
    }

    or:

    wp_mail($from, ‘YOUR CUSTOM SUBJECT GOES HERE’, $message, $header);

    But everyone of those topics are addressing changing default Subject line to another one. My problem is that I need different Subjects for different forms and different languages.

    Thank you,

    Ivan

    #515351

    Hi!

    Maybe something like this would work.

    add_filter(‘avf_form_subject’,’avia_change_mail_subject’, 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params)
    {
    $my_current_lang = apply_filters( 'wpml_current_language', NULL );
    $page12 = "Subject on page 12";
    $page13 = "Subject on page 13";
    if ( $my_current_lang == "de" ) { $page12 = "German title"; $page13 = "Germain title"; }
    if ( is_page(12) ) { $subject = $page12; }
    if ( is_page(13) ) { $subject = $page13; }
    return $subject;
    }

    Regards,
    Elliott

    #515356

    Hello Elliott,

    Thanks for this. If I understand correct, if I have 3 forms at 3 pages, I should add also line

    $page14 = “Subject on page 14”;

    and so on…

    But how do I define page? Should I enter name of the page as is in permalink, or should I put whole http address?

    And, for English, do I need to add

    if ( $my_current_lang == “en” ) { $page12 = “English title”; $page13 = “English title”; }

    under

    if ( $my_current_lang == “de” ) { $page12 = “German title”; $page13 = “Germain title”; }

    Just, I have no idea, about this, so sorry if I am writing nonsense.

    Ivan

    #515372

    Hi!

    You can add another check for English but it’s not necessary.

    The numbers, 12, 13, correspond to the page IDs. You can view the IDs in Dashboard > Pages by hovering over the “Edit” link of each page. The ID will be displayed in the URL.

    You can also check by the page slug as well, https://codex.wordpress.org/Function_Reference/is_page.

    Cheers!
    Elliott

    • This reply was modified 9 years, 1 month ago by Elliott.
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.