• Hi, our site is under development still. We are using the age check on two pages (careers) as well as support: https://bandai.v0efspcx-liquidwebsites.com/support/. The legal team wants the cookie to remain even after closing and reopening the browser window. They literally want the user to have to be clever enough to delete cookies or try a different browser to get in if they fail the age check. Is there a way to keep the plugin from deleting the cookie when the browser is closed?

    Thanks!
    Sharon

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @scolombo,

    What’s the scenario here, is if if they pass or fail the age check?

    If it’s for passing, then there’s a filter called age_gate_cookie_length where you can set the amount of time (days by default, age_gate_cookie_timescale to change that).

    If you’re looking to do this for users failing, then it’s still possible, but a bit more involved so I’ll work that bit out if that’s what you need!

    Thanks
    Phil

    Thread Starter scolombo

    (@scolombo)

    Hi Phil, it is if they fail. The legal department wants the age check to be harder to get around for kids (even though I think most kids know how to lie about their age!!). So they want the the checker to keep them from trying again…for some amount of time, with the only work around being that they clear their cookies.

    Thank you so much!
    Sharon

    Plugin Author Phil

    (@philsbury)

    Hi Sharon,

    Ah legal depts!

    It’s actually quite straight forward. First uncheck the option to rechallenge if you haven’t already in the Restriction settings. If they fail this will set a cookie called ‘age_gate_failed’ for the session. We can then just hook onto anything else really and extend it:

    
    add_action('init', function () {
        if (isset($_COOKIE['age_gate_failed'])) {
            setcookie('age_gate_failed', 1, strtotime("+ 10 years"), COOKIEPATH, COOKIE_DOMAIN);
        }
    });
    

    That should be all there is to it. Just change the strtotime to whatever fist your needs. COOKIEPATH and COOKIE_DOMAIN should be ok if this is the only age check.

    Hope that sorts it for you.

    Thanks
    Phil

    Thread Starter scolombo

    (@scolombo)

    Ok, I’ll give this a go. Thank you!

    Thread Starter scolombo

    (@scolombo)

    Ok the age_gate_failed cookie is updating correctly to add 10 years, but it still allows me to try again even without closing the browser tab. Why would that be? Then it also allows a try again if I close the window. Any ideas?

    I did uncheck the “try again” checkbox.

    Also, I use this on TWO pages – I could certainly argue with the legal department that they should enter their age in both places – but this should work across the site, right?

    Thanks,
    Sharon

    Plugin Author Phil

    (@philsbury)

    Hi Sharon,

    That’s odd, it’s working ok for me on a test site and still blocking me.

    It should work across the pages assuming the cookie is being set at the root path.

    Have you put it on your test link as I’ll happily have a look.

    Thanks
    Phil

    Thread Starter scolombo

    (@scolombo)

    https://bandai.v0efspcx-liquidwebsites.com/careers/
    https://bandai.v0efspcx-liquidwebsites.com/support/

    Those are the two pages – when I reopen after being blocked it lets me try again…is it really not doing that for you? Sometimes I try a shift-refresh to reload completely and it still makes me reenter the date.

    Check your cookies on this and let me know what you see.

    Thanks!
    Sharon

    Plugin Author Phil

    (@philsbury)

    Hi Sharon,

    I get the same as you, cookie set but still lets me try again. My version is doing it fine and I’ve just tried a variety of settings combos.

    Is there some sort of caching happening as if I go to:
    https://bandai.v0efspcx-liquidwebsites.com/careers/?v=12345

    It tells me I’m too young as it should

    Thanks
    Phil

    Thread Starter scolombo

    (@scolombo)

    Good to know. There is an IT team who set up the hosting for us so I don’t have access to that. I will reach out to them as it’s probably what’s happening. However, I’m not sure they will be willing to turn it off – what are your thoughts? Can it work if there is caching?? I’m thinking maybe legal and IT will have to duke this one out!!

    I will find out and let you know. Thank you for the attention! More soon.

    Sharon

    Plugin Author Phil

    (@philsbury)

    No problem, happy to help!

    There is a JavaScript version you can turn on, but as it’s client side it just overlays the content with the age gate so might not satisfy the legal people as the content is just hidden behind it.

    The IT guys can hopefully disable caching for either certain pages or particular cookies being set.

    Let me know how you get on.

    Thanks
    Phil

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Keep the Cookie’ is closed to new replies.