Login     Sign up
How to change sign up year
Glen Williamson (@glennfun)
Join date: Aug 21st 2010
Community posts: 8
View Profile
Send Message

I would like to limit my site to only those 18 or older. So I would only like to have people born before 1992 only to sign up. How to I date out the year after 1992? ... i.e. I would like to take out 1993, 1994 all the way to 2002.

Also, I would like to change the Gender from Male and Female to Single and Couple.

Thanks in advance,

Glen

176 months ago
adil (@adil)
Join date: May 9th 2010
Community posts: 202
View Profile
Send Message

hi

open /modules/member/member.php around line 448 you will find this

[code]
<select name="birthyear" class="fpost">
');
$year_from = date("Y",time()) - 8;
$year_to = date("Y",time()) - 100;
if ($_REQUEST['birthyear'])
$yearkey = $_REQUEST['birthyear'];
else
$yearkey = $year_from - 12;
for ($i=$year_from;$i>$year_to;$i--) {
$selected = '';
if ($yearkey == $i)
$selected = 'selected';
c('<option value="'.$i.'" '.$selected.'>'.$i.'</option>');
}
if ($row['hide_age']) $hide_age = 'checked';
c('
</select>
[/code]

modify as your needs
for gender in the same file around line 490 find
[code]
c('
<tr class="row1"><td>*'.t('Gender').'</td><td>
<input type="radio" name="gender" value="1" '.$gender1.' />'.t('Male').'
<input type="radio" name="gender" value="0" '.$gender0.' />'.t('Female').'
<input type="radio" name="gender" value="2" '.$gender2.' />'.t('Hide').'
</td></tr>');
[/code]
change it but still in the data base will be stored as 0, 1 ,3 and in the profile will a pear like male /female so you will need to change /modules/u/u.php also!!! so it is better for you to make a customfields from your admin panel to ask about status
adil

176 months ago
Glen Williamson (@glennfun)
Join date: Aug 21st 2010
Community posts: 8
View Profile
Send Message

Adil,

Thanks for your reply, but I'm not a programmer. If I wanted to limit it to someone born after July 1992, how do I do that in the code below? Can you modify and give me an example?

Thanks,

Glen

<select name="birthyear" class="fpost">
');
$year_from = date("Y",time()) - 8;
$year_to = date("Y",time()) - 100;
if ($_REQUEST['birthyear'])
$yearkey = $_REQUEST['birthyear'];
else
$yearkey = $year_from - 12;
for ($i=$year_from;$i>$year_to;$i--) {
$selected = '';
if ($yearkey == $i)
$selected = 'selected';
c('<option value="'.$i.'" '.$selected.'>'.$i.'</option>');
}
if ($row['hide_age']) $hide_age = 'checked';
c('
</select>

176 months ago
Glen Williamson (@glennfun)
Join date: Aug 21st 2010
Community posts: 8
View Profile
Send Message

OK, I figured it out... I made these changes and it works.

Code

<select name="birthyear" class="fpost">
');
$year_from = date("Y",time()) - [b]18;[/b]
$year_to = date("Y",time()) - 100;
if ($_REQUEST['birthyear'])
$yearkey = $_REQUEST['birthyear'];
else
$yearkey = $year_from - [b]22;[/b]
for ($i=$year_from;$i>$year_to;$i--) {
$selected = '';
if ($yearkey == $i)
$selected = 'selected';
c('<option value="'.$i.'" '.$selected.'>'.$i.'</option>');
}
if ($row['hide_age']) $hide_age = 'checked';
c('

176 months ago