Tagged: autorespond, CONTACT FORM
-
AuthorPosts
-
July 10, 2018 at 9:16 am #983543
Hey guys,
I’m using the contact form as a registration form for an event. Now I want to send an autorespond text but only to the ones that confirm/attend the event (Checkbox “yes/I’m coming). The ones that choose not to (Checkbox “no/not coming) should not receive any e-mail back. Is that possible?
Thank you so much in advance for your response.
Kind regards
AlineJuly 10, 2018 at 1:53 pm #983678Hey Aline,
Thank you for using Enfold.
Mind if we take a look at the contact form? Please provide a link to the page. You can try this filter to set the autorespose email to null when the senders didn’t check the box.
add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 55, 3); function avf_form_autoresponder_from_mod( $to, $post, $params ) { if($post['3_1'] == false) { $to = null; } return $to; }
Best regards,
IsmaelJuly 10, 2018 at 2:12 pm #983689This reply has been marked as private.July 10, 2018 at 9:12 pm #983829Hi,
have you tried the code of Ismael? Can you please let us know.
Best regards,
BasilisJuly 11, 2018 at 8:25 am #984063Hi
Yes, it doesn’t do anything. In the Custom CSS red crosses appear in the sense of error reports. Using a code block on the specific page doesn’t do anything either.
Isn’t that more of a general code? Because we don’t have just one box to check, there are two (see my explanation above). So a code that says “if the box isn’t checked, there will be no autoresponse e-mail” doesn’t help. It would have to be if box a is checked = autoresponse e-mail and if box b is checked = no autoresponse e-mail.
Do you know what I mean?
Thanks and kind regards
AlineJuly 12, 2018 at 1:58 am #984404Hi,
Thanks for the update.
We’ve added the code in the child theme’s functions.php file. That is where it’s supposed to be added. We also adjusted it a bit so it detects the checkbox of your contact form. When this box is set to false or when the user didn’t check it, the “autoresponseto” email will be set to null.
Best regards,
IsmaelJuly 12, 2018 at 8:39 am #984559Hey guys,
Thanks I just tested it out. But I still get a message/e-mail, even though I checked the right box (“Ich bin leider verhindert”) saying I’m not attending.
Best regards
AlineJuly 13, 2018 at 9:43 am #985057Hi,
I see. I didn’t know there’s another checkbox. We adjusted the filter a bit.
add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 55, 3); function avf_form_autoresponder_from_mod( $to, $post, $params ) { if($post['8_1'] == false || $post['9_1'] == true) { $to = null; } return $to; }
I can’t find the form. Did you remove it?
Best regards,
IsmaelJuly 16, 2018 at 10:56 am #985891Hi,
No, I didn’t remove it. But the form is not public, you’ll find it via the link in the backend http://realit.ch/wp-admin/post.php?post=9374&action=edit
The code doesn’t seem to work. Now no autoresonse e-mail is sent at all…
Thanks and kind regards
AlineJuly 17, 2018 at 2:46 am #986179Hi,
This is the actual response when you sent the form. The “avia_8_1” is the “Ich bin dabei” checkbox and it’s going to be empty when it’s not checked. The “avia_9_1” is the other checkbox.
avia_1_1: Test avia_2_1: Test avia_3_1: Test avia_4_1: Test avia_5_1: Test avia_6_1: Test avia_7_1: Test%40test.com avia_8_1: avia_9_1: true avia_10_1: Nein avia_11_1: Test avia_12_1: avia_generated_form1: 1
I adjusted the filter a bit.
add_filter('avf_form_autoresponder_from', 'avf_form_autoresponder_from_mod', 55, 3); function avf_form_autoresponder_from_mod( $to, $post, $params ) { if($post['8_1'] === '' || $post['9_1'] === 'true') { $to = null; } return $to; }
That filter will set the “autoresponse” email to null or empty when the “Ich bin dabei” checkbox was not ticked or when the “Ich bin leider verhindert” was checked.
NOTE: Users have to check one of the options. Autoresponse will be sent if they don’t.
Best regards,
IsmaelJuly 24, 2018 at 11:43 am #989120Hey Ismael
Thanks, it works perfectly!
Quick question. Would it also be possible to get an autoresponse as well (a different one) for the other checkbox (Ich bin leider verhindert)? Meaning you’d have two different autoresponses for the two checkboxes…
Thanks for the feedback.
Kind regards,
AlineJuly 24, 2018 at 1:03 pm #989152Hi,
Glad it worked. You can try this filter for those who are not attending.
add_filter('avf_form_custom_autoresponder', 'avf_form_custom_autoresponder_mod', 55, 3); function avf_form_custom_autoresponder_mod( $message, $object, $post ) { ob_start(); /** * enter your autoresponse markup here */ ?> <div> <h2>We are very sorry to hear that you're not attending.</h2> Hope we'll see you in the next event. Best regards, Luke Skywalker </div> <?php $response = ob_get_contents(); ob_end_clean(); if($post['9_1'] === 'true') $message = $response; return $message; }
Adjust the html markup as required.
Best regards,
IsmaelJuly 24, 2018 at 4:54 pm #989253Where can I insert that? In the Enfold Child Theme: Stylesheet (style.css) or in the Custom CSS?
Thanks and best regards,
AlineJuly 25, 2018 at 7:16 am #989513Hi,
You should add that filter in the functions.php file along with the previous code.
Best regards,
IsmaelJuly 31, 2018 at 12:00 pm #991889Hey guys
The Code below:
add_filter(‘avf_form_autoresponder_from’, ‘avf_form_autoresponder_from_mod’, 55, 3);
function avf_form_autoresponder_from_mod( $to, $post, $params ) {
if($post[‘8_1’] === ‘true’ || $post[‘9_1’] === ”) {
$to = null;
}
return $to;
}worked fine but from time to time it doesn’t work anymore which I don’t understand.
Now the autoresponse gets sent no matter which checkbox you choose. Although the code says only to send it when 8_1 is ticked (“Ich bin dabei”).
Can someone please help real quick, thank you.
July 31, 2018 at 12:35 pm #991900Figured it out, working again! Just had to insert ‘false’ for 9_1
July 31, 2018 at 1:17 pm #991916Hi!
Glad you solved the problem :)
Cheers!
Peter -
AuthorPosts
- The topic ‘contact form autorespond text’ is closed to new replies.