allow birthdays with just a year (no month or day).
This commit is contained in:
parent
a8322ba1f6
commit
a39a1584bd
@ -953,15 +953,20 @@ function advanced_profile(&$a) {
|
|||||||
|
|
||||||
|
|
||||||
if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
|
if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
|
||||||
|
|
||||||
|
$val = '';
|
||||||
|
|
||||||
|
if((substr($a->profile['dob'],5,2) === '00') || (substr($a->profile['dob'],8,2) === '00'))
|
||||||
|
$val = substr($a->profile['dob'],0,4);
|
||||||
|
|
||||||
$year_bd_format = t('j F, Y');
|
$year_bd_format = t('j F, Y');
|
||||||
$short_bd_format = t('j F');
|
$short_bd_format = t('j F');
|
||||||
|
|
||||||
|
if(! $val) {
|
||||||
$val = ((intval($a->profile['dob']))
|
$val = ((intval($a->profile['dob']))
|
||||||
? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format))
|
? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format))
|
||||||
: day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],5) . ' 00:00 +00:00',$short_bd_format)));
|
: day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],5) . ' 00:00 +00:00',$short_bd_format)));
|
||||||
|
}
|
||||||
$profile['birthday'] = array( t('Birthday:'), $val);
|
$profile['birthday'] = array( t('Birthday:'), $val);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -190,9 +190,9 @@ function profiles_post(&$a) {
|
|||||||
if(($day > $mtab[$month]) || ($day < 0))
|
if(($day > $mtab[$month]) || ($day < 0))
|
||||||
$day = 0;
|
$day = 0;
|
||||||
|
|
||||||
if($year && (! ($month && $day))) {
|
// if($year && (! ($month && $day))) {
|
||||||
$month = 1; $day = 1;
|
// $month = 1; $day = 1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$dob = '0000-00-00';
|
$dob = '0000-00-00';
|
||||||
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
|
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
|
||||||
|
Reference in New Issue
Block a user