Support » Plugin: MailChimp Widget » [Plugin: MailChimp Widget] Option or filter to control the cookie

  • I like this plugin, but I don’t want the signup form to be removed after the user signs up. The footer area in my theme just looks too empty without something there to visually fill it. I also saw a post from another user who wanted to set the expiration of the cookie.

    Both of those could be accomplished if you added an option and/or filter to the expiration value in setcookie(). For example

    $expiration = apply_filters( 'mcw_cookie_expiration', time() + 31556926 );
    setcookie($this->id_base . '-' . $this->number, $this->hash_mailing_list_id(), $expiration);

    I’d encourage you to add filters and actions throughout your plugin; otherwise it’s impossible for users to modify or customize the plugin behavior without forking it or modifying core files that will get overwritten on upgrade.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I second this as I too do not want the form removed. If anything, make an option to show form after signup. Or rather, an option to hide it. Should be shown by default. The novice Web user will think the Web site broke after they signed up. Believe me, I field tech support calls all day long. Its an overall bad idea to hide form. What if they entered wrong email email address and realized just as they clicked submit? They will not know to flush their cookies/close the browser to re-show the form.

    Hi, Love the Mailchimp widget, works like a charm. But… can I second the removal of or option to remove the cookie being set.

    Same reason as the other 2 guys, as its WordPress and a template, when the Signup box disappears it makes my site look bare where the chimp plugin was.

    Great plugin though, if anyone knows, how to manually edit the code to achieve stopping the cookie, I’d appreciate it. I’m no codemonkey but I can get around if pointed in the right direction.

    Cheers all.

    BlackArtist, you can edit line 217 of
    lib/ns_widget_mailchimp.class.php and change

    setcookie($this->id_base . '-' . $this->number, $this->hash_mailing_list_id(), time() + 31556926);


    //setcookie($this->id_base . '-' . $this->number, $this->hash_mailing_list_id(), time() + 31556926);

    The will prevent the cookie from being set at all. You could also change 31556926 — that’s one year in seconds — to a smaller number to decrease the expiration limit.

    That’s not really a good solution, though, because, it’ll just get overridden when the plugin is updated. The correct way is for the author to provide an option or filter so that it can be changed without editing the plugin’s files.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: MailChimp Widget] Option or filter to control the cookie’ is closed to new replies.