• Resolved oddjobs

    (@oddjobs)


    It seems the plugin doesn’t respect the COOKIE_DOMAIN environment variable. In wp-config.php it is possible to set the following;

    define( 'COOKIE_DOMAIN', '.. domain name ..');

    My understanding is that there is an expectation of plugins using this environment variable when setting cookies. For example, if this is set for “domain.name”, then any site that is available as “domain.name” or “www.domain.name” will share the same set of cookies.

    As it stands this seems not to be the case, so I’m finding the plugin confirming on one domain, then not making the resulting cookie available to the other domain. (which has the potential to break compliance?)

    There seems to be a very simple solution, in class-frontend.php, line # 264, if you replace get_cookie_domain() with COOKIE_DOMAIN ? COOKIE_DOMAIN : get_cookie_domain(), then everything seems to work as expected.

    Is there any chance this change could be incorporated? Also, is there any way to submit PR’s? I would have done this if the code were on Github, but I can’t seem to find the Repo?

    • This topic was modified 2 years, 3 months ago by oddjobs.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support CookieYes Team

    (@cookieyesteam)

    Hi @oddjobs,

    Greetings from CookieYes!

    Sorry that we couldn’t change this in the plugin, as it will affect other users. We will check for a custom solution for you, so please share your site health information privately via this link.

    Thread Starter oddjobs

    (@oddjobs)

    Ok, so if the environment variable is not set for a user, it won’t affect them. If it is set, it’s set because the user wants cookies to be handled on a specific domain. Alternatively, you could add a new environment variable like “COOKIE_YES_DOMAIN”.

    How will this affect other users?

    Plugin Support CookieYes Team

    (@cookieyesteam)

    Hi @oddjobs,

    Please try the below code snippet to change the domain of the cookieyes-consent cookie:

    add_filter(
        'cky_cookie_domain',
        function() {
            return "domain.name";
        }
    );

    Make sure that you replace the “domain.name” with your respective domain.

    Thread Starter oddjobs

    (@oddjobs)

    Hi @cookieyesteam,

    I’ve inserted that at the end of my config.php, seems to do the trick!

    Many thanks!

    Plugin Support CookieYes Team

    (@cookieyesteam)

    Hi @oddjobs,

    This thread has been inactive for a bit, so we are going to mark it as resolved now. Please feel free to open a new thread or follow-up if you have any further questions or still need help.

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

The topic ‘Plugin and COOKIE_DOMAIN’ is closed to new replies.