Hi there,
Sure thing but it depends entirely on the thing you’re trying to integrate with. You can filter the box rules and keep the box hidden if a certain cookie is set so if you can set a cookie upon submitting a form, you’re good to go.
Here is the example code for MailChimp for WordPress.
// copy paste the following functions anywhere in your theme its functions.php file
function my_prefix_set_mailchimp_cookie($email, $merge_vars, $form_id, $result) {
if($result == true) {
setcookie("mc4wp_subscribed", $email, time() + 31556926, '/');
}
}
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);
I am thinking of adding a few integrations to the plugin to handle this kind of stuff automatically for some of the more popular plugins (like MailChimp for WordPress and Contact Form 7) so stay tuned. 🙂
The above code can be simplified to the following snippet if you’re using MailChimp for WP version 1.5.4 or higher.
function myprefix_show_stb_box( $matched, $box_id ) {
if( isset( $_COOKIE['mc4wp_email'] ) ) {
return false;
}
return $matched;
}
add_action('stb_show_box', 'myprefix_show_stb_box', 10, 2);