• Resolved Kathy_Goss

    (@kathy_goss)


    Hi Joel,
    I have a multisite network which approximately 40% are using domain mapping. I have found that users are not able to logout on the domain mapped sites and that it requires a clear browser cache in order to actually logout on the devices’s browser. The user is not logged in on other devices or browsers.

    Can your plugin work with multisite? If so, would you network install or mu-plugin?

    Also, we have an affiliate program, I would assume that this will also clear out the affiliate cookies as well.

Viewing 1 replies (of 1 total)
  • Plugin Author joelhardi

    (@joelhardi)

    Hi, thanks for your question.

    The answer is “I think so” but I haven’t tested it with multisite or domain mapping.

    This plugin clears all cookies that are set on the COOKIE_DOMAIN, which I can see is defined by WordPress for multisite in wp-includes/ms-default-constants.php according to this logic:

      if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
        if ( !empty( $current_network->cookie_domain ) )
          define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain);
        else
          define('COOKIE_DOMAIN', '.' . $current_network->domain);
      }

    But based on this link, it looks like when you use domain mapping you’re supposed to define COOKIE_DOMAIN manually in wp-config.php to the root domain name — this is where the codex page says to add define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']); to wp-config.php.

    Anyway, I don’t totally understand your situation, so here are a couple of scenarios. Suppose your site is example.com and you have got domain-mapped sites like foo.example.com and bar.example.com:

    • when a user logs out of foo, if COOKIE_DOMAIN is set to foo.example.com, then the plugin won’t clear cookies set on bar.example.com
    • when a user logs out of foo, if COOKIE_DOMAIN is set to example.com, then the plugin should clear all cookies on example.com — I think this is what you want? … if so would need to make sure COOKIE_DOMAIN is set to example.com. In this situation though, there’s going to be a collision and users won’t be able to have active logged in sessions with foo.example.com and bar.example.com at the same time

    If we aren’t talking about subdomains at all, and your domain-mapped sites have totally different names, then there is nothing this plugin or anything else can do to clear cookies on a different domain. Keep in mind that this plugin, WordPress, *any* website can only set and clear cookies on the domain that it is running. This is all controlled by the security model of the browser. Like if google.com had the ability to access cookies set by facebook.com, it would be anarchy! So this plugin and any plugin can only unset cookies on its own domain. Not sure if that is relevant to your question about affiliate cookies or not, just thought I’d mention it. Only the user can clear third-party cookies in their browser, you can’t do this from the server or using JavaScript.

Viewing 1 replies (of 1 total)
  • The topic ‘Will this work with multisite?’ is closed to new replies.