Support » Plugin: Age Gate » The plugin does not do the age calculation well.

  • josecostaros



    I have installed the plugin and I really love it, but … I have found a bug and I have tried it in other links published here and it does the same.
    (My site is closed at the moment).

    The fault is that the calculation of age does not do it correctly.

    For example,

    if today is 03/06/2018 and I configure in the plugin the majority of age to 18 years … if I want to enter with 02/06/2000, it does not allow it. I have tried with previous days and neither, with months either … one year, 02/06/1999, ok. ?

    How do I solve it?

    Thank you.

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

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


    Hi Joe,

    I think there may be a timezone issue, all my tests have so far not managed to get the wrong age. However, looking at the timezone of my dev server it is reading UTC, whereas WordPress is set to London. I wonder if that is causing an issue potentially.

    I suspected this as when you reported this, you said it was the 3/6, but in the UK it was still the 2nd!

    I’m going to look into it and see if I can get some sort of resolution. I am going to be away though for a few days, but I’ll try and get something worked out before then.

    If you could let me know what your settings are though that’d be useful, fi you add the following to your themes functions.php and just paste the output into a reply:

    echo "<pre>";
    wp_die('Date: ' . date_default_timezone_get() . PHP_EOL . 'WP: ' . get_option('timezone_string'));

    Then just delete those lines again.




    Hello Phil, today I updated and now I enter correctly without touching anything …

    I have tried the code that you indicated to me but it does not work for me, it only appears on a blank page:

    Date: UTC

    no data.

    The configuration of my WP is UTC + 2 (I’m in Spain).

    Thanks for this great plugin. 5*


    Plugin Author Phil


    Hi Joe,

    I think it’s a possible timezone issue where there’s a crossover of days. I’ve added some extra timezone checks to try and better calculate age based on the settings in WP and falling back to the server if need be.

    Based on the info above, it will calculate on UTC, so there’s a two hour window in Spain where a user could be old enough but not get through.

    The WP setting indicates you’re using the standard language in WordPress. Based on that, I think I may add my own setting to override the timezone within the plugin itself.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The plugin does not do the age calculation well.’ is closed to new replies.