Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #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
    Aline

    #983678

    Hey 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,
    Ismael

    #983689
    This reply has been marked as private.
    #983829

    Hi,

    have you tried the code of Ismael? Can you please let us know.

    Best regards,
    Basilis

    #984063

    Hi

    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
    Aline

    #984404

    Hi,

    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,
    Ismael

    #984559

    Hey 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
    Aline

    #985057

    Hi,

    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,
    Ismael

    #985891

    Hi,

    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
    Aline

    #986179

    Hi,

    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,
    Ismael

    #989120

    Hey 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,
    Aline

    #989152

    Hi,

    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,
    Ismael

    #989253

    Where can I insert that? In the Enfold Child Theme: Stylesheet (style.css) or in the Custom CSS?

    Thanks and best regards,
    Aline

    #989513

    Hi,

    You should add that filter in the functions.php file along with the previous code.

    Best regards,
    Ismael

    #991889

    Hey 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.

    #991900

    Figured it out, working again! Just had to insert ‘false’ for 9_1

    #991916

    Hi!

    Glad you solved the problem :)

    Cheers!
    Peter

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

The topic ‘contact form autorespond text’ is closed to new replies.