diff --git a/plugins/ExtendedProfile/extendedprofile.php b/plugins/ExtendedProfile/extendedprofile.php index 673680f027..fa632e5073 100644 --- a/plugins/ExtendedProfile/extendedprofile.php +++ b/plugins/ExtendedProfile/extendedprofile.php @@ -98,6 +98,15 @@ class ExtendedProfile } } + function getDateValue($name) { + $key = strtolower($name); + if (array_key_exists($key, $this->fields)) { + return $this->fields[$key][0]->date; + } else { + return null; + } + } + // XXX: getPhones, getIms, and getWebsites pretty much do the same thing, // so refactor. function getPhones() diff --git a/plugins/ExtendedProfile/extendedprofilewidget.php b/plugins/ExtendedProfile/extendedprofilewidget.php index 25a0ab8b20..622beff32f 100644 --- a/plugins/ExtendedProfile/extendedprofilewidget.php +++ b/plugins/ExtendedProfile/extendedprofilewidget.php @@ -493,11 +493,14 @@ class ExtendedProfileWidget extends Form $this->out->text($this->ext->getTextValue($name)); break; case 'date': - $this->out->element( - 'div', - array('class' => 'field date'), - date('j M Y', strtotime($this->ext->getTextValue($name))) - ); + $value = $this->ext->getDateValue($name); + if (!empty($value)) { + $this->out->element( + 'div', + array('class' => 'field date'), + date('j M Y', strtotime($value)) + ); + } break; case 'person': $this->out->text($this->ext->getTextValue($name)); @@ -549,7 +552,7 @@ class ExtendedProfileWidget extends Form $out->input( $id, null, - date('j M Y', strtotime($this->ext->getTextValue($name))) + date('j M Y', strtotime($this->ext->getDateValue($name))) ); break; case 'person': diff --git a/plugins/ExtendedProfile/profiledetailsettingsaction.php b/plugins/ExtendedProfile/profiledetailsettingsaction.php index 13bf43b927..719717e088 100644 --- a/plugins/ExtendedProfile/profiledetailsettingsaction.php +++ b/plugins/ExtendedProfile/profiledetailsettingsaction.php @@ -113,10 +113,14 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction foreach ($dateFieldNames as $name) { $value = $this->trimmed('extprofile-' . $name); + $dateVal = $this->parseDate($name, $value); $this->saveField( $user, $name, - $this->parseDate($name, $value) + null, + null, + null, + $dateVal ); }