Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Danny,

    Thank you, thank you! This totally worked! I really appreciate you helping me.

    Is there a way for me to include the cookie set by MC4WP? I just realized that plug-in also sets a cookie called mc4wp_email.

    Is it possible to incorporate that into function we just created so past subscribers don’t get the pop-up either until the cookie expires?

    So, after looking through the support history, I figured out how to set a cookie if the user submits the form so that the box isn’t displayed again (I put this in my functions.php file and I use Mailchimp for WordPress for my form).

    The problem now is… this hides all boxes. Is there a way for me to adjust the cookie so that is only hides the box ID that contained the form?

    function my_prefix_set_mailchimp_cookie($email, $merge_vars, $form_id, $result) {
    	if($result == true) {
    		setcookie("mc4wp_subscribed", $email, time() + 7776000, '/');
    	}
    }
    
    add_action('mc4wp_after_subscribe', 'my_prefix_set_mailchimp_cookie', 10, 4);
    
    function my_prefix_show_stb_box($matched, $box_id) {
    	if(isset($_COOKIE['mc4wp_subscribed'])) {
    		return false;
    	}
    	return $matched;
    }
    add_action('stb_show_box', 'my_prefix_show_stb_box', 10, 2);

    Was this request ever implemented?

    I have my box working as it should, but don’t want the box to show up if the user hit the submit button. I’m not sure how I can write a cookie to make sure the box is dismissed.

    Thread Starter limee78

    (@limee78)

    Hi Danny,

    My apologies for not responding. Thank for sharing this option. I decided to do away with the thank you page. 🙂

    Great plug-in btw.

Viewing 4 replies - 1 through 4 (of 4 total)