2007-05-17, 11:33 AM
2007-05-17, 01:16 PM
Birthday: Saturday, November 18th, 1978 (29 years old)
mine is off as well
seems like they are calculating the year you are turning 29 even though its not the date yet
mine is off as well
seems like they are calculating the year you are turning 29 even though its not the date yet
2007-05-17, 01:54 PM
Pretty sure it's duplicate: http://community.mybboard.net/showthread.php?tid=19252
2007-05-17, 03:06 PM
No, I was using that fixed file, Tikitiki.
2007-05-17, 04:49 PM
This Fix is from Michael83. He post it in german myBB.
Open member.php and search:
replace with:
Open member.php and search:
$lang->membdayage = sprintf($lang->membdayage, ($year - $membday['2']));
replace with:
$lang->membdayage = sprintf($lang->membdayage, ($year - $membday['2'] - 1));
2007-05-17, 05:03 PM
i am still alive Wrote:This Fix is from Michael83. He post it in german myBB.
Open member.php and search:
$lang->membdayage = sprintf($lang->membdayage, ($year - $membday['2']));
replace with:
$lang->membdayage = sprintf($lang->membdayage, ($year - $membday['2'] - 1));
Tested ::
For ex. i fill in as bday [ 20 January 1985 ]
result :: 21y (should be 22)
Edit ::
I've changed the thing into ... and seems to work =P
$age = get_age($memprofile['birthday']);
$lang->membdayage = sprintf($lang->membdayage, $age);
2007-05-17, 10:06 PM
Great. Now we're back to the original code...
2007-05-18, 03:58 AM
Fixed.
(You may also download the two attached files and replace inc/functions.php and ./member.php with them.
Instructions for fixing.
Open up inc/functions.php and find:
Replace with:
Open member.php and find:
Replace with:
(You may also download the two attached files and replace inc/functions.php and ./member.php with them.
Instructions for fixing.
Open up inc/functions.php and find:
function get_age($birthday)
{
$bday = explode("-", $birthday);
if($bday[2] < 1970)
{
$years = 1970-$bday[2];
$year = $bday[2]+($years*2);
$stamp = mktime(0, 0, 0, $bday[1], $bday[0], $year)-($years*31556926*2);
}
else
{
$stamp = mktime(0, 0, 0, $bday[1], $bday[0], $bday[2]);
}
$age = floor((time()-$stamp)/31556926);
return $age;
}
Replace with:
function get_age($birthday)
{
$bday = explode("-", $birthday);
if(!$bday[2])
{
return;
}
list($day, $month, $year) = explode("-", my_date("j-n-Y", time(), 0, 0));
$age = $year-$bday[2];
if(($month == $bday[1] && $day < $bday[1]) || $month < $bday[1])
{
--$age;
}
return $age;
}
Open member.php and find:
$lang->membdayage = sprintf($lang->membdayage, ($year - $membday['2']));
Replace with:
$lang->membdayage = sprintf($lang->membdayage, get_age($memprofile['birthday']));
2007-05-18, 07:28 AM
Not fixed =P
If you enter 14 May 1985 , it returns 21y ! ( should be 22 )
If the month is different from the one it actually is ex. you enter 14 March 1985 , it returns 22y. And 14 September 1985 returns 21y, that's correct =P
Edit ::
This
Should become
If you enter 14 May 1985 , it returns 21y ! ( should be 22 )
If the month is different from the one it actually is ex. you enter 14 March 1985 , it returns 22y. And 14 September 1985 returns 21y, that's correct =P
Edit ::
This
if(($month == $bday[1] && $bday[1] < $day) || $month < $bday[1])
Should become
if(($month == $bday[1] && $bday[0] > $day) || $month < $bday[1])
2007-05-18, 07:48 AM
[edit] That'll teach me for forgetting to submit the Quick Reply form for 20 minutes.
Actually it didn't - it caused wrong ages to be displayed.
There was a typo in what I pasted above.
Should be:
Actually it didn't - it caused wrong ages to be displayed.
There was a typo in what I pasted above.
if(($month == $bday[1] && $bday[1] < $day) || $month < $bday[1])
Should be:
if(($month == $bday[1] && $day < $bday[0]) || $month < $bday[1])