[buddypress-trac] [BuddyPress] #2963: XProfile - Bugs with the type datebox
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Mon Dec 20 10:49:34 UTC 2010
#2963: XProfile - Bugs with the type datebox
-------------------------------------------------+-------------------------
Reporter: calvin_42 | Owner:
Type: defect | Status: new
Priority: normal | Milestone: Awaiting
Component: XProfile | Review
Keywords: xprofile_screen_edit_profile, | Version: 1.3
strtotime, bp_get_the_profile_field_options |
-------------------------------------------------+-------------------------
To record dates into the database, xprofile_screen_edit_profile() uses
strtotime ([http://trac.buddypress.org/browser/tags/1.2.6/bp-
xprofile.php#L307 Link]).
The [http://fr.php.net/manual/en/function.strtotime.php documentation]
stipulates :
{{{
''The valid range of a timestamp is typically from Fri, 13 Dec 1901
20:45:54 UTC
to Tue, 19 Jan 2038 03:14:07 UTC''
}}}
There is 2 bugs in the current version of BuddyPress :
* bp_get_the_profile_field_options() doesn't take this limits in account
([http://trac.buddypress.org/browser/tags/1.2.6/bp-xprofile/bp-xprofile-
templatetags.php#L448 Link]) and display years 1900 and 1901 which cannot
be saved.
* If the user select the date ''January 1 1970'', the strtotime result
will be 0 and this value won't be saved because of the following test in
xprofile_set_field_data() ([http://trac.buddypress.org/browser/tags/1.2.6
/bp-xprofile.php#L721 Link])
{{{
/* If the value is empty, then delete any field data that exists */
if ( empty( $value ) ) {
xprofile_delete_field_data( $field_id, $user_id );
return true;
}
}}}
Moreover only the current and the past years are displayed. So the context
is limited to displays birthdays or past events, not future ones.
'''IMHO, strtotime should be not used and the date should be serialized in
string.'''
--
Ticket URL: <http://trac.buddypress.org/ticket/2963>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list