[buddypress-trac] [BuddyPress Trac] #6789: XProfile: do not store serialized arrays for multi-value profile field data

buddypress-trac noreply at wordpress.org
Mon Jun 19 15:05:48 UTC 2017


#6789: XProfile: do not store serialized arrays for multi-value profile field data
------------------------------+-----------------------------
 Reporter:  Offereins         |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Future Release
Component:  Extended Profile  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |
------------------------------+-----------------------------

Comment (by Offereins):

 Some notes on the WIP changes presented in the latest patch.

 === In `BP_XProfile_ProfileData` ===

 * `populate()` - multiple values are returned as an array per field.
 * `save()` - multiple values are stored as multiple rows. The previous
 rows are deleted through calling `$this->delete()`. The new id of the data
 object is the one from the first created data row.
 * `get_data_for_user()` - multiple values are returned as an array per
 field.
 * `get_fielddataid_byid()` - no changes, but the main data id is returned
 in case of multiple-value fields.
 * `get_value_by_id()` - multiple values are returned as an array per
 field.
 * `get_value_byfieldname()` - multiple values are returned as an array per
 field.
 * `get_random()` - a subquery is used to find the random field id, then
 all related data is fetched.

 === In xprofile functions ===

 * `xprofile_get_field_data()` - multiple values are intercepted through
 `bp_xprofile_field_supports_multiple_values()`, but further logic stands
 as before.
 * `xprofile_set_field_data()` - multiple values are sent in as an array of
 serialized values (in case of multiple array values).
 * `bp_unserialize_profile_field()` - now also parses arrays into comma-
 separated lists.

 Further checking on template functions parsing field data is TBD.

 === Considerations ===

 Since multiple values previously were stored and returned as serialized
 arrays, should we now return non-serialized row data also as a
 (re)serialized array - to keep backpat in order? Then data would be stored
 in the new fashion, but returned as is done previously. Any ideas about
 that?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6789#comment:15>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list