Support » Plugin: BP Profile Search » Serialized Strings Appearing On Profile Search Forms

  • Resolved Howdoisound

    (@agilejelly)


    Hi Andrea!

    It’s me again. You helped with our initial issue with serialized strings appearing in the BP Profile Search results by making some modifications to the plugin, which we SO much appreciate, but I just noticed another bug that I’m totally stuck on trying to fix (I also sent you an email regarding this bug – subject line: “BP Profile Search Support Thread Credentials – Dan / OHA”, but figured I’d also post to the support forums in case this helps anyone else with a similar issue).

    In short, the new bug I noticed is that the values in text fields that are comma separated are displaying as serialized strings when clicking in to edit these fields within a user profile. On the front end, comma separated values display just fine, but again, when clicking into to edit a user profile, an BP profile search comma separated values are displaying as serialized – like they were previously on the front end, and consequentially saving as serialized if we save any changes to user profiles containing fields with comma separated values.

    Example:

    Front end (values display normal): Galehead: 1995, 1998 Fall

    Login to edit profile (values display – and save as – serialized): a:2:{i:0;s:4:”1995″;i:1;s:9:”1998 Fall”;}

    We’d be grateful for any suggestions you’d be willing to offer.

    Thank you so much in advance, and let me know if you need more info.

    Daniel

Viewing 1 replies (of 1 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Daniel,

    That happens when you have a field of type Checkboxes or Multi Select Box and later you change the type to Text Box. The already existing values are then shown as serialized strings.

    You can fix the problem with this code:

    add_filter ('bp_get_the_profile_field_edit_value', 'my_unserialize', 10, 3);
    function my_unserialize ($value, $type, $id)
    {
    	global $members_template;
    
    	if ($type != 'textbox')  return $value;
    
    	$value = BP_XProfile_ProfileData::get_value_byid ($id, $members_template->member->ID);
    	$new = @unserialize ($value);
    	return $new? implode (', ', $new): $value;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Serialized Strings Appearing On Profile Search Forms’ is closed to new replies.