Viewing 24 posts - 1 through 24 (of 24 total)
  • Author
    Posts
  • #876000

    Dear Kriesi team,
    I am currently using several contact forms. Some contain the field <Name> others contain the field <First Name>.
    Is there a way to modify functions.php so that the auto response will contain “Dear <Name>,” or “Dear <First Name>,”
    Both with a blank line before the message body?

    Is there a workaround if that is not easily achieved?

    Thanks!

    #876317

    Hey ofekw,

    Here are the hooks / filters available which you can use to modify the forms
    https://github.com/KriesiMedia/enfold-library/tree/master/actions%20and%20filters/ALB%20Elements/Contact%20Form

    Check them, and you can create any type of function you need.

    let us know if there is something else we can do for you

    Best regards,
    Basilis

    #876412

    Hello Basilis,
    Thanks for these links.

    What we are trying to achieve is pre-pending the “Dear <First Name>” without affecting the rest of the autoresponse message as defined in the page builder. i.e., each contact form will have its own custom message.

    Can you help please?

    #877326

    Hi,

    Please add the following filter in the functions.php file.

    function avf_form_custom_autoresponder_mod( $out, $user_input, $contact_form, $contact_form_input )
    {
      ob_start();
    
      /**
       * Enter your HTML template or include one
       */
      ?>
      <div>
      <h2>Thank you for contacting us.</h2>
      <p>We will answer your request as soon as possible.</p>
      <p>Best regards<br />
      Your Enfold Support Team
      </p>
      </div>
      <?php
      $message = ob_get_contents();
      ob_end_clean();
    	$out =	$message . "<br/><br/><strong>Dear <" . $contact_form_input['1_1'] . "></strong><br/><br/>" . $out;
    	return $out;
    }
    add_filter( 'avf_form_custom_autoresponder', 'avf_form_custom_autoresponder_mod', 10, 4 );
    

    Change the HTML output as needed.

    Best regards,
    Ismael

    #877945

    Dear Ismael,

    Thanks for your message.

    This code replaces the content of ALL autoresponders. We only want to prep-end “Dear <First Name>” without affecting the rest of the message as defined in the page builder.

    Can you help please?

    Thanks!

    ofekw

    #878701

    Thanks Ismael,

    This code causes the body of the autoresponse messages to be “Dear ” and nothing else. I tried tweaking the code to $contact_form_input[‘avia_1_1’] because the name and ID of the field is actually “avia_1_1” but still no success.

    Is there possibly some syntax or other error we are missing here?

    Much appreciated,

    ofekw

    #879461

    Hi,

    Please post the login details in the private field. Or replace the code with the following.

    function avf_form_custom_autoresponder_mod( $out, $user_input, $contact_form, $contact_form_input )
    {
    	$out =	"<strong>Dear " . urldecode($contact_form_input['1_1']). "</strong><br/><br/>" . $contact_form->form_params['autoresponder'];
    	return $out;
    }
    add_filter( 'avf_form_custom_autoresponder', 'avf_form_custom_autoresponder_mod', 10, 4 );

    `

    Best regards,
    Ismael

    #880026

    Hello Ismael,

    Thanks for following up.

    Getting close now, this code gives us “Dear <first name>” but nothing else. It’s missing the rest of the autoresponder message as per each contact form.

    Please advise.

    Thanks!

    ofekw

    #880078

    Hey!

    Thank you for the update. We modified the fitler a bit. Please try it again and don’t forget to remove the browser cache before testing the contact form page. If it’s still not working, please post the FTP and WP login details in the private field so that we can test it.

    Best regards,
    Ismael

    #880581

    Hi Ismael,

    Thanks for the update, this now works great when one word is entered in the <Name> or <First Name>fields. However it does not work properly when there is a space entered in the name string. For example, when using the name: “Ilan Wittenberg”, this is the email received:

    Dear Ilan%20Wittenberg

    without the autoresponder message.

    1. Can the code display the entire string properly even when there is a space entered (plus the autoresponder message)?

    2. Can you add a comma after the name please?

    Thanks!
    ofekw

    #880992

    Hello Ismael,
    You are welcome to test the auto responder by using the contact forms and see.
    Have placed a few links below.
    Please note that the first line of the autoresponder will contain “%20” if a space is entered in the <Name> string.
    Thanks!
    ofekw

    #881067

    Hi,

    We modified the code. Please try it again. Don’t forget to remove the browsre cache. Or post the login details in the private field so that we can test it.

    Best regards,
    Ismael

    #881074

    Hello Ismael,

    Unfortunately there is no change from the previous test.

    You are welcome to test the autoresponder message by entering a message in the contact forms links below. The message will be sent to your email and you can verify the resulting autoresponder issue.

    All forms currently show %20 when there is a space in the first string.

    The first link below does not show the autoresponder message in the email sent, the other two do. Not sure why the first contact form shows only: “Dear <name>…”

    Thanks,

    ofekw

    #881805

    Hi,

    I’m not sure why it wouldn’t work for the other “contact” form if they have the same configuration. Please post the login details in the private field.

    Best regards,
    Ismael

    #881809
    This reply has been marked as private.
    #881819

    Hi,

    Thank you for the info. Please set the user role to admin so that we can modify the filter. Make sure that the Appearance > Editor panel is accessible.

    Best regards,
    Ismael

    #881821
    This reply has been marked as private.
    #882099

    Hi,

    Thank you for the update. The “autoresponder” parameter is empty in the contact page so we had to add it manually in the filter.

    Best regards,
    Ismael

    #882544

    Thanks for sorting this Ismael and also for resolving the %20 when space was used in the name!

    Be great to have a comma after the <first name> if possible. For example: Dear Ismael,

    Very much appreciated,

    ofekw

    #883400

    Hi,

    In the filter, please look for this part.

      "</strong><br><br>"
    

    Just add the comma before the closing < / strong > tag.

      ",</strong><br><br>"
    

    Best regards,
    Ismael

    #1031124

    Hello Ismael,

    There are a few contact forms on my website:
    This Register form: http://ilanwittenberg.com/contact/ shows only the header line: “Dear <first Name>,” without the body of the Autorespond Text.
    This Booking form: http://ilanwittenberg.com/booking/ works perfectly: header line + Autorespond Text.
    These two forms are also good: http://ilanwittenberg.com/register/ and http://ilanwittenberg.com/be-in-to-win

    I cannot find any difference between them.

    Please advise,

    ofekw

    #1032429

    Hi,

    Did you add any html tags to the custom autoresponder message? Please make sure that the tags are closed properly.

    Best regards,
    Ismael

    #1032434

    Thanks Ismael!

    #1032833

    Hi,

    You’re welcome. Please open a new thread if you need anything else. :)

    Best regards,
    Ismael

Viewing 24 posts - 1 through 24 (of 24 total)

The topic ‘Customising Autoresponder using multiple contact forms’ is closed to new replies.