Support » Plugin: Age Gate » Region, State or Province option?

  • Hi,
    Is there any ability in the plugin to add a field for Region, State or Province? Looking to use in Canada where we have different age limits by province. My thought is have the user self-select their province, which would update the minimum age for the site.

    Thank you,

    Colin

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

    (@philsbury)

    Hi Colin,

    I’ve had to give this one some thought!

    It is possible, but it could make some features not work as expected, for instance it would nullify the multiple ages option. Though it sounds like that wouldn’t be an issue in this case.

    I’ve put together a bit of code to show how this can work, but it will need a bit of adjustment to get working as you want. You can download it here. It’s just a plugin you can install.

    There’s two main files; age-gate-canadian-province.php and select-dropdown.js. You’ll need to alter the following:

    • In the PHP file, there’s an array of the provinces each with an age, just change these to whatever you need. Note that Yukon is currently set to be 65!
    • In the JS file, if you are using the JavaScript version of the age gate, you can leave it as it is, if you are using Standard PHP (in the advanced settings), you’ll need to remove/comment out lines 17 and 19.

    I hope that helps at the very least as a starting point!

    Let me know how it goes.

    Thanks
    Phil

    Hi @philsbury

    This worked for me.
    You have developed a great plugin.
    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Region, State or Province option?’ is closed to new replies.