[buddypress-trac] [BuddyPress] #2947: bp_get_the_profile_field_options( 'type=datebox' ) - missing saved value and "type" parameter in filter
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Mon Jan 3 22:05:46 UTC 2011
#2947: bp_get_the_profile_field_options( 'type=datebox' ) - missing saved value
and "type" parameter in filter
-----------------------+-----------------------------
Reporter: r-a-y | Owner:
Type: defect | Status: new
Priority: normal | Milestone: Awaiting Review
Component: XProfile | Version: 1.3
Resolution: | Keywords: has-patch
-----------------------+-----------------------------
Comment (by boonebgorges):
Thanks for the patches, guys.
cnorris23, your patch had a problem or two of its own ($selected needs to
be reset on each iteration through the $options loop). But it also
uncovered some inconsistencies with the way that BP was handling default
values. In particular, two of the profile field types - multiselectbox and
checkboxes - allow the admin to set default values, but they also allow
the user to save a null value for that field. That causes a problem,
because if the user unchecks all the boxes (in the case of checkboxes),
then xprofile thinks it should reapply the default values on the next
load.
This problem was not visible before because of some bugs in xprofile that
cnorris23's patch uncovered.
2947.003.patch cleans up cnorris23's patch, and fixes the default value
problem described above by allowing those two kinds of fields to save an
empty array to the xprofile_data table. That way, BP can distinguish
between when a user has not yet provided a value for the profile field in
question and should use the default value (namely, when
BP_XProfile_ProfileData::get_value_byid() returns null), and when a user
has intentionally saved zero of the available choices (when
BP_XProfile_ProfileData::get_value_byid() returns an empty array).
I'm sorry to wrap this problem up with the original one, but the fixes
were closely related. Please give it a test with all the different kinds
of profile fields and default values.
--
Ticket URL: <http://trac.buddypress.org/ticket/2947#comment:4>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list