2
i actually did this in my photo+profiles hack back in 2.0.10 days.
the hacks still available but is now defunct & unsupported since 2.0.13.2 because better methods came about.. such as smartprofile & formulize + reg codes etc.
but for your info you could probably disect the hack & use the script i made for displaying the users age instead of date of birth.
in include/functions.php
add this to the end >
// ----------- added by m0nty for profile fields hack ----------------
function CalcAge($date_of_birth) { // make sure it's YYYY-MM-DD
$cur_year=date("Y");
$cur_month=date("m");
$cur_day=date("d");
$dob_year=substr($date_of_birth, 0, 4);
$dob_month=substr($date_of_birth, 5, 2);
$dob_day=substr($date_of_birth, 8, 2);
if($cur_month>$dob_month || ($dob_month==$cur_month && $cur_day>=$dob_day) )
return $cur_year-$dob_year;
else
return $cur_year-$dob_year-1;
}
// ----------- end of profile fields hack ----------------
remember to make sure the date submitted is in format YYYY-MM-DD
then to use the function.
in userinfo.php
you'll need your date of birth in the DB.
then simply use >
CalcAge($thisUser->getVar('user_birth'));
to translate the dob to an actual age.
if you need more help, let me know.. or if you wish to disect my profile hack you're welcome. just pm me your email and i'll send you the last 2.0.13.2 version
you'll see in the hack tho, i created and used a dobcalendar.js and used that on the edituser form etc to input the dob field instead of having users type it in.