Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#4109 closed enhancement (fixed)

xprofile_get_field_data not unserializing values

Reported by: shanebp Owned by:
Priority: normal Milestone: 1.6
Component: Extended Profile Version:
Severity: minor Keywords:
Cc:

Description

Not sure if this is a bug, but the 1.5.5 rework of bp-xprofile has this side effect:

http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/bp-1-5-unserialize-profile-field/

Or maybe there was a change to WP is_serialized() ?

Change History (6)

#1 @shanebp
14 years ago

  • Component CoreXProfile

#2 @boonebgorges
14 years ago

the 1.5.5 rework of bp-xprofile

Was there a 1.5.5 rework? Is this a regression from 1.5.4?

#3 @shanebp
14 years ago

Sorry - I meant 1.5.
I'm using 1.5.5

Last edited 14 years ago by shanebp (previous) (diff)

#4 @boonebgorges
14 years ago

  • Milestone Awaiting Review1.6
  • Severity normalminor
  • Type defect (bug)enhancement

I've had a closer look.

The issue is not serialization. The value returned by xprofile_get_field_data() is indeed unserialized; see this line in the function:

$values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) );

(See http://www.php.net/serialize for more on serialize() in PHP)

What shanebp is pointing toward is that the values returned by xprofile_get_field_data() are left in an array rather than being converted to a comma-separated string. (In contrast, bp_get_the_profile_field_value() runs its values through bp_unserialize_profile_field() before returning, which both unserializes *and* converts to a comma-separated string.) This is not a regression from 1.2.x, though there was a bug in this function 1.2.x that actually *was* related to serialization.

In any case, it seems clear that this is not a bug. And it would break backward-compatibility if the behavior of this function were changed outright. However, I think it's reasonable to add an argument to xprofile_get_field_data() that will allow you to request a comma-separated string instead of a raw array. I'm going to commit such a change shortly.

#5 @boonebgorges
14 years ago

  • Resolutionfixed
  • Status newclosed

(In [5962]) Adds multi_format parameter to xprofile_get_field_data(), so that values can be returned in a comma-separated string for easier theming. Fixes #4109

#6 @shanebp
14 years ago

Thanks for the interpretation of my garbled report.
And thanks for the fix.

Note: See TracTickets for help on using tickets.