Thank you.
I think that helped, but I'm still not getting the results I'm looking for.
I'm pretty sure I've translated something in my function code wrong, but I just can't see where.
This is now my function:
PHP Code:
function calculate_age($userinfo)
{
global $vbulletin;
if (!isset($userinfo['birthday']))
{
return false;
} else {
$today_year = date('Y');
$today_month = date('n');
$today_day = date('j');
$bday = explode('-', $userinfo['birthday']);
if (date('Y') > $bday[2] AND $bday[2] > 1901 AND $bday[2] != '0000')
{
if ($today_year > $bday[2] AND $bday[2] != '0000')
{
$userinfo['age'] = $today_year - $bday[2];
if ($bday[0] > $today_month)
{
$userinfo['age']--;
}
else if ($bday[0] == $today_month AND $today_day < $bday[1])
{
$userinfo['age']--;
}
}
else
{
return false;
}
if (!isset($userinfo['age']) AND ($userinfo['age'] < 18))
{
return false;
} else {
return $userinfo['age'];
}
} else {
return false;
}
}
}
Here's what I have now for my permissions statement:
PHP Code:
$age = calculate_age($userinfo);
// access permissions
if ((!is_member_of($vbulletin->userinfo, 5, 6, 7)) OR (!$age))
{
// give no permission unless in usergroup x, y, or z
print_no_permission();
}