Zen Cart Logo
Forums / General Questions / Age restriction

Age restriction

Views: 1,492

Results 1 to 6 of 6
13 Dec 2013, 10:59 PM
#1
dereck72 avatar

dereck72

New Zenner

Join Date:
Jul 2013
Posts:
16
Plugin Contributions:
0

Age restriction

I used the tutorial http://www.zen-cart.com/content.php?253-how-can-i-limit-the-age-of-my-customers-to-people-over-18. That worked great for sign-up; however, how can you prevent someone signing up over 18 and going back later and changing their birthdate to under 18? I've searched the forum and cannot find what files would need to be edited. I'd image it would be the same lines of code as entered in includes/modules/create_account.php and includes/languages/english/create_account.php. Would that be correct?

13 Dec 2013, 11:58 PM
#2
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,788
Plugin Contributions:
22

Re: Age restriction

If you don't want them to EDIT their DOB after they register, you'll need to edit the following file:
includes/templates/YOUR_TEMPLATE/templates/tpl_account_edit_default.php
Find and remove this piece of code:

<?php
  if (ACCOUNT_DOB == 'true') {
?>
<label class="inputLabel" for="dob"><?php echo ENTRY_DATE_OF_BIRTH; ?></label>
<?php echo zen_draw_input_field('dob', zen_date_short($account->fields['customers_dob']), 'id="dob"') . (zen_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="alert">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php
  }
?>

If that file doesn't exist in YOUR_TEMPLATE folder, copy it from template_default and upload to your template's directory. It's always better to use overrides. :wink:

20 Dec 2013, 5:24 AM
#3
dereck72 avatar

dereck72

New Zenner

Join Date:
Jul 2013
Posts:
16
Plugin Contributions:
0

Re: Age restriction

Thanks for the fast response! I would like to allow them to change it in case they entered the wrong date when they signed up, but restrict it to over eighteen when they do. Out of curiosity, whats the advantage to having the file located in the YOUR_TEMPLATE folder?

20 Dec 2013, 12:01 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: Age restriction

dereck72:

... Out of curiosity, whats the advantage to having the file located in the YOUR_TEMPLATE folder?
YOUR_TEMPLATE (another name for your custom template) allows you to customize your shop in a manner that the customizations will 'carry over' when you upgrade your Zen Cart's software. There's a FAQ here: http://www.zen-cart.com/content.php?228-understanding-the-override-system

20 Dec 2013, 12:24 PM
#5
dereck72 avatar

dereck72

New Zenner

Join Date:
Jul 2013
Posts:
16
Plugin Contributions:
0

Re: Age restriction

Thanks for that, makes perfect sense.

20 Dec 2013, 3:25 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Age restriction

What is the point of preventing users from resetting their birthdate below 18? You are dependent on their word anyway, and they could be 12 or 88 regardless of what they tell you. If you have mechanisms in place to restrict signup and especially login to 18+, you have evidence that you have done all that can practically be done.

The test I would add is to the login/returning user page, to check the saved user DOB. If they are foolish enough to reset that below 18 after lying to sign up, it will catch them.