Age Gate module for SilverStripe.

Installs: 101

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 2

Open Issues: 1


2.1.0 2018-05-08 14:12 UTC

This package is auto-updated.

Last update: 2023-01-15 00:46:03 UTC


Simple Age Gate module for SilverStripe, ensures that users entering site are 21+.


  • SilverStripe 4.0.0+, for 3.x checkout 3.x branch

Installation & Documentation

  1. Clone Repository to your SilverStripe Project or -

     composer require moosylvania/silverstripe-age-gate
  2. This will add a route /age-gate to your project and all users will be presented with a yes/no button to validate of age. If you would like the user to type in their date of birth you can set the config option of 'askForAge'

       askForAge: true

    To set the format of the dates you can change the config values 'dateFormat' (for the form intro text) and 'dateFieldFormat' for the actual SilverStripe Date Field.

       dateFormat: 'm/d/Y'
       dateFieldFormat: 'MM/dd/yyyy'
  3. You can set up where you want a user redirected to if they select 'No' (not of age) by adding the following config value to your site -

       notOfAgeRedirect: ''
  4. You can also setup how old someone needs to be to enter your site (default is 21 by editing the setting)

Moosylvania\AgeGate\Controllers\AgeGateController: yearsOld: 21

  1. Run a dev/build?flush=1 and your site will now be agegated.