Ticket #6789: 6789.06.patch
| File 6789.06.patch, 22.5 KB (added by , 9 years ago) |
|---|
-
src/bp-xprofile/bp-xprofile-filters.php
diff --git a/src/bp-xprofile/bp-xprofile-filters.php b/src/bp-xprofile/bp-xprofile-filters.php index dd3f7c567..33997a130 100644
a b function xprofile_filter_kses( $content, $data_obj = null ) { 154 154 * Safely runs profile field data through kses and force_balance_tags. 155 155 * 156 156 * @since 1.2.6 157 * @since 3.0.0 The `$field_value` parameter accepts an array. 157 158 * 158 * @param string $field_value Field value being santized. 159 * @param int $field_id Field ID being sanitized. 160 * @param bool $reserialize Whether to reserialize arrays before returning. Defaults to true. 161 * @param object|null $data_obj The BP_XProfile_ProfileData object. 159 * @param string $field_value Field value being santized. 160 * @param int $field_id Field ID being sanitized. 161 * @param bool $reserialize Whether to reserialize arrays before returning. Defaults to true. 162 * @param object|null $data_obj The BP_XProfile_ProfileData object. 163 * @return string|array 162 164 * @return string 163 165 */ 164 166 function xprofile_sanitize_data_value_before_save( $field_value, $field_id = 0, $reserialize = true, $data_obj = null ) { … … function xprofile_sanitize_data_value_before_save( $field_value, $field_id = 0, 176 178 // Value might be a serialized array of options. 177 179 $field_value = maybe_unserialize( $field_value ); 178 180 181 // Return if empty. Special-case support for integer 0 for the number field type. 182 if ( empty( $field_value ) && ! is_integer( $field_value ) && $field_value !== '0' ) { 183 return $field_value; 184 } 185 179 186 // Sanitize single field value. 180 if ( ! is_array( $field_value) ) {187 if ( ! $data_obj || ! bp_xprofile_field_supports_multiple_values( $data_obj->field_id ) ) { 181 188 $kses_field_value = xprofile_filter_kses( $field_value, $data_obj ); 182 189 $filtered_field_value = wp_rel_nofollow( force_balance_tags( $kses_field_value ) ); 183 190 … … function xprofile_sanitize_data_value_before_save( $field_value, $field_id = 0, 185 192 * Filters the kses-filtered data before saving to database. 186 193 * 187 194 * @since 1.5.0 195 * @since 3.0.0 The `$filtered_field_value` accepts an array. 188 196 * 189 * @param string $filtered_field_value The filtered value.197 * @param string|array $filtered_field_value The filtered value. 190 198 * @param string $field_value The original value before filtering. 191 199 * @param BP_XProfile_ProfileData $data_obj The BP_XProfile_ProfileData object. 192 200 */ 193 201 $filtered_field_value = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_field_value, $field_value, $data_obj ); 194 202 203 if ( ! empty( $reserialize ) ) { 204 $filtered_field_value = maybe_serialize( $filtered_field_value ); 205 } 206 195 207 // Sanitize multiple individual option values. 196 208 } else { 197 209 $filtered_values = array(); 198 210 foreach ( (array) $field_value as $value ) { 199 $kses_field_value = xprofile_filter_kses( $value, $data_obj ); 200 $filtered_value = wp_rel_nofollow( force_balance_tags( $kses_field_value ) ); 211 $unserialized_value = maybe_unserialize( $value ); 212 $kses_field_value = xprofile_filter_kses( $unserialized_value, $data_obj ); 213 $filtered_value = wp_rel_nofollow( force_balance_tags( $kses_field_value ) ); 201 214 202 215 /** This filter is documented in bp-xprofile/bp-xprofile-filters.php */ 203 216 $filtered_values[] = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_value, $value, $data_obj ); 204 217 } 205 218 206 if ( ! empty( $reserialize ) ) {207 $filtered_field_value = serialize($filtered_values );219 if ( ! empty( $reserialize ) ) { 220 $filtered_field_value = array_map( 'maybe_serialize', $filtered_values ); 208 221 } else { 209 222 $filtered_field_value = $filtered_values; 210 223 } -
src/bp-xprofile/bp-xprofile-functions.php
diff --git a/src/bp-xprofile/bp-xprofile-functions.php b/src/bp-xprofile/bp-xprofile-functions.php index 337d2cd79..c34625f01 100644
a b function xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' 362 362 363 363 $values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) ); 364 364 365 if ( is_array( $values ) ) { 365 // Consider multiple values. 366 if ( bp_xprofile_field_supports_multiple_values( $field_id ) ) { 367 $values = array_map( 'maybe_unserialize', $values ); 366 368 $data = array(); 367 369 foreach( (array) $values as $value ) { 368 370 … … function xprofile_set_field_data( $field, $user_id, $value, $is_required = false 467 469 $field->user_id = $user_id; 468 470 469 471 // Gets un/reserialized via xprofile_sanitize_data_value_before_save() 470 $field->value = maybe_serialize( $value ); 472 if ( bp_xprofile_field_supports_multiple_values( $field_id ) ) { 473 $field->value = array_map( 'maybe_serialize', $value ); 474 } else { 475 $field->value = maybe_serialize( $value ); 476 } 471 477 472 478 return $field->save(); 473 479 } … … function xprofile_get_random_profile_data( $user_id, $exclude_fullname = true ) 641 647 * Formats a profile field according to its type. [ TODO: Should really be moved to filters ] 642 648 * 643 649 * @since 1.0.0 650 * @since 3.0.0 The `$field_value` parameter can be an array. 644 651 * 645 * @param string $field_type The type of field: datebox, selectbox, textbox etc.646 * @param string $field_value The actual value.652 * @param string $field_type The type of field: datebox, selectbox, textbox etc. 653 * @param string|array $field_value The actual value. 647 654 * @return string|bool The formatted value, or false if value is empty. 648 655 */ 649 656 function xprofile_format_profile_field( $field_type, $field_value ) { … … function bp_xprofile_is_richtext_enabled_for_field( $field_id = null ) { 1146 1153 return apply_filters( 'bp_xprofile_is_richtext_enabled_for_field', $enabled, $field_id ); 1147 1154 } 1148 1155 1156 /** 1157 * Does this profile field support multiple values? 1158 * 1159 * @since 3.0.0 1160 * 1161 * @param int|null $field_id Optional. Default current field ID. 1162 * @return bool Whether the field supports multiple values 1163 */ 1164 function bp_xprofile_field_supports_multiple_values( $field_id = null ) { 1165 if ( ! $field_id ) { 1166 $field_id = bp_get_the_profile_field_id(); 1167 } 1168 1169 $field = xprofile_get_field( $field_id, null, false ); 1170 1171 $supports = false; 1172 if ( $field instanceof BP_XProfile_Field ) { 1173 $supports = (bool) $field->type_obj->supports_multiple_values; 1174 } 1175 1176 /** 1177 * Filters whether the given field supports multiple values. 1178 * 1179 * @since 3.0.0 1180 * 1181 * @param bool $supports True if the field supports multiple values, otherwise false. 1182 * @param int $field_id ID of the field. 1183 */ 1184 return (bool) apply_filters( 'bp_xprofile_field_supports_multiple_values', $supports, $field_id ); 1185 } 1186 1149 1187 /** 1150 1188 * Get visibility levels out of the $bp global. 1151 1189 * -
src/bp-xprofile/bp-xprofile-template.php
diff --git a/src/bp-xprofile/bp-xprofile-template.php b/src/bp-xprofile/bp-xprofile-template.php index afe5162ec..e4f8ad277 100644
a b function bp_the_profile_field_visibility_level_label() { 903 903 * comma-separated string. 904 904 * 905 905 * @since 1.0.0 906 * @since 3.0.0 The `$value` parameter can be an array. 906 907 * 907 * @param string $value Content to maybe unserialize.908 * @param string|array $value Content to maybe unserialize. 908 909 * @return string 909 910 */ 910 911 function bp_unserialize_profile_field( $value ) { 911 if ( is_serialized( $value) ) {912 $field_value = @unserialize($value);912 if ( is_serialized( $value ) || is_array( $value ) ) { 913 $field_value = maybe_unserialize( $value ); 913 914 $field_value = implode( ', ', $field_value ); 914 915 return $field_value; 915 916 } -
src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php
diff --git a/src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php b/src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php index f3717d3dc..895e07082 100644
a b class BP_XProfile_Field_Type_Checkbox extends BP_XProfile_Field_Type { 28 28 $this->category = _x( 'Multi Fields', 'xprofile field type category', 'buddypress' ); 29 29 $this->name = _x( 'Checkboxes', 'xprofile field type', 'buddypress' ); 30 30 31 $this->supports_multiple_values = true; 31 32 $this->supports_multiple_defaults = true; 32 33 $this->accepts_null_value = true; 33 34 $this->supports_options = true; -
src/bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php
diff --git a/src/bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php b/src/bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php index d56b25be4..718b79d2a 100644
a b class BP_XProfile_Field_Type_Multiselectbox extends BP_XProfile_Field_Type { 28 28 $this->category = _x( 'Multi Fields', 'xprofile field type category', 'buddypress' ); 29 29 $this->name = _x( 'Multi Select Box', 'xprofile field type', 'buddypress' ); 30 30 31 $this->supports_multiple_values = true; 31 32 $this->supports_multiple_defaults = true; 32 33 $this->accepts_null_value = true; 33 34 $this->supports_options = true; -
src/bp-xprofile/classes/class-bp-xprofile-field-type.php
diff --git a/src/bp-xprofile/classes/class-bp-xprofile-field-type.php b/src/bp-xprofile/classes/class-bp-xprofile-field-type.php index 65a970c68..66e451df4 100644
a b abstract class BP_XProfile_Field_Type { 65 65 */ 66 66 public $supports_options = false; 67 67 68 /** 69 * If allowed to store multiple values. 70 * 71 * @since 3.0.0 72 * @var bool Does this field support multiple values? e.g. multiselectbox, checkbox. 73 */ 74 public $supports_multiple_values = false; 75 68 76 /** 69 77 * If allowed to support multiple options as default. 70 78 * -
src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
diff --git a/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php b/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php index 62603e7c0..c02201134 100644
a b class BP_XProfile_ProfileData { 89 89 $bp = buddypress(); 90 90 91 91 $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_id ); 92 $profiledata = $wpdb->get_r ow( $sql );92 $profiledata = $wpdb->get_results( $sql ); 93 93 94 94 if ( $profiledata ) { 95 96 // If the field supports multiple values, an array should be returned. 97 if ( bp_xprofile_field_supports_multiple_values( $profiledata[0]->field_id ) ) { 98 $profiledata[0]->value = wp_list_pluck( $profiledata, 'value' ); 99 100 // Parse empty list 101 if ( array() === maybe_unserialize( $profiledata[0]->value ) ) { 102 $profiledata[0]->value = array(); 103 } 104 } 105 106 // Get the first row 107 $profiledata = $profiledata[0]; 95 108 wp_cache_set( $cache_key, $profiledata, 'bp_xprofile_data' ); 96 109 } 97 110 } … … class BP_XProfile_ProfileData { 100 113 $this->id = (int) $profiledata->id; 101 114 $this->user_id = (int) $profiledata->user_id; 102 115 $this->field_id = (int) $profiledata->field_id; 103 $this->value = stripslashes( $profiledata->value );116 $this->value = is_array( $profiledata->value ) ? array_map( 'stripslashes', $profiledata->value ) : stripslashes( $profiledata->value ); 104 117 $this->last_updated = $profiledata->last_updated; 105 118 106 119 } else { … … class BP_XProfile_ProfileData { 184 197 185 198 $bp = buddypress(); 186 199 187 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id ); 188 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id ); 189 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id, true, $this ); 200 /** 201 * Filters the data's user ID before saving to the database. 202 * 203 * @since 1.0.0 204 * 205 * @param int $user_id The user ID. 206 * @param int $data_id The field data ID. 207 */ 208 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id ); 209 210 /** 211 * Filters the data's field ID before saving to the database. 212 * 213 * @since 1.0.0 214 * 215 * @param int $field_id The field ID. 216 * @param int $data_id The field data ID. 217 */ 218 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id ); 219 220 /** 221 * Filters the data's value before saving to the database. 222 * 223 * @since 1.0.0 224 * @since 2.1.0 Added `$reserialize` and `$this` parameters. 225 * 226 * @param string $field_value The field value. 227 * @param int $data_id The field data ID. 228 * @param bool $reserialize Whether to reserialize arrays before returning. Defaults to true. 229 * @param BP_XProfile_ProfileData $this Current instance of the profile data being saved. 230 */ 231 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id, true, $this ); 232 233 /** 234 * Filters the data's last updated timestamp before saving to the database. 235 * 236 * @since 1.0.0 237 * 238 * @param int $last_updated The last updated timestamp. 239 * @param int $data_id The field data ID. 240 */ 190 241 $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', bp_core_current_time(), $this->id ); 191 242 192 243 /** … … class BP_XProfile_ProfileData { 201 252 do_action_ref_array( 'xprofile_data_before_save', array( $this ) ); 202 253 203 254 if ( $this->is_valid_field() ) { 204 if ( $this->exists() && strlen( trim( $this->value ) ) ) { 255 256 // Special-case support for integer 0 for the number field type 257 $value_is_empty = empty( $this->value ) && ! is_integer( $this->value ) && '0' !== $this->value; 258 259 // Store as multiple values 260 if ( $this->exists() && bp_xprofile_field_supports_multiple_values( $this->field_id ) ) { 261 262 // Delete previous rows. 263 $this->delete(); 264 265 // Store empty list as serialized array 266 if ( empty( $this->value ) ) { 267 $this->value = array( serialize( array() ) ); 268 } 269 270 // Store each value in a separate row 271 foreach ( array_values( (array) $this->value ) as $k => $value ) { 272 $result = $wpdb->query( $wpdb->prepare("INSERT INTO {$bp->profile->table_name_data} (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $value, $this->last_updated ) ); 273 274 // Use the first inserted id as the new data identifier 275 if ( 0 === $k ) { 276 $this->id = $wpdb->insert_id; 277 } 278 } 279 280 // Store as single value 281 } elseif ( $this->exists() && ! $value_is_empty ) { 205 282 $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_data} SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id ) ); 206 283 207 } elseif ( $this->exists() && empty( $this->value ) ) {208 // Data removed, delete the entry.284 // Data removed, delete the entry. 285 } elseif ( $this->exists() && $value_is_empty ) { 209 286 $result = $this->delete(); 210 287 211 } else {288 } elseif ( ! $value_is_empty ) { 212 289 $result = $wpdb->query( $wpdb->prepare("INSERT INTO {$bp->profile->table_name_data} (user_id, field_id, value, last_updated) VALUES (%d, %d, %s, %s)", $this->user_id, $this->field_id, $this->value, $this->last_updated ) ); 213 290 $this->id = $wpdb->insert_id; 214 291 } … … class BP_XProfile_ProfileData { 299 376 // Rekey. 300 377 $queried_data = array(); 301 378 foreach ( $uncached_data as $ud ) { 302 $d = new stdClass; 303 $d->id = $ud->id; 304 $d->user_id = $ud->user_id; 305 $d->field_id = $ud->field_id; 306 $d->value = $ud->value; 307 $d->last_updated = $ud->last_updated; 308 309 $queried_data[ $ud->field_id ] = $d; 379 380 // Set initial field data 381 if ( ! isset( $queried_data[ $ud->field_id ] ) ) { 382 $d = new stdClass; 383 $d->id = $ud->id; 384 $d->user_id = $ud->user_id; 385 $d->field_id = $ud->field_id; 386 $d->last_updated = $ud->last_updated; 387 388 // Collect multiple values in array 389 // TODO: no stripslashing here? See ::populate() 390 if ( bp_xprofile_field_supports_multiple_values( $ud->field_id ) ) { 391 $d->value = ( array() === maybe_unserialize( $ud->value ) ) ? array() : array( $ud->value ); 392 } else { 393 $d->value = $ud->value; 394 } 395 396 $queried_data[ $ud->field_id ] = $d; 397 398 // Collect multiple values per field 399 } elseif ( bp_xprofile_field_supports_multiple_values( $ud->field_id ) ) { 400 // TODO: no stripslashing here? See ::populate() 401 $queried_data[ $ud->field_id ]->value[] = $ud->value; 402 } 310 403 } 311 404 312 405 // Set caches. … … class BP_XProfile_ProfileData { 325 418 $d->id = ''; 326 419 $d->user_id = $user_id; 327 420 $d->field_id = $field_id; 328 $d->value = '';421 $d->value = bp_xprofile_field_supports_multiple_values( $field_id ) ? array() : ''; 329 422 $d->last_updated = ''; 330 423 331 424 wp_cache_set( $cache_key, $d, 'bp_xprofile_data' ); … … class BP_XProfile_ProfileData { 405 498 * Get the user's field data id by the id of the xprofile field. 406 499 * 407 500 * @since 1.6.0 501 * @since 3.0.0 Returns the first/main data id in case of multiple values. 408 502 * 409 503 * @param int $field_id Field ID being queried for. 410 504 * @param int $user_id User ID associated with field. … … class BP_XProfile_ProfileData { 471 565 $bp = buddypress(); 472 566 $uncached_ids_sql = implode( ',', $uncached_ids ); 473 567 $queried_data = $wpdb->get_results( $wpdb->prepare( "SELECT id, user_id, field_id, value, last_updated FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id IN ({$uncached_ids_sql})", $field_id ) ); 568 $multiple = bp_xprofile_field_supports_multiple_values( $field_id ); 474 569 475 570 // Rekey. 476 571 $qd = array(); 477 572 foreach ( $queried_data as $data ) { 478 $qd[ $data->user_id ] = $data; 573 574 // Set initial user data 575 if ( ! isset( $qd[ $data->user_id ] ) ) { 576 577 // Collect multiple values in array 578 if ( $multiple ) { 579 // TODO: no stripslashing here? See ::populate(). 580 $data->value = ( array() === maybe_unserialize( $data->value ) ) ? array() : array( $data->value ); 581 } 582 583 $qd[ $data->user_id ] = $data; 584 585 // Collect multiple values per field 586 } elseif ( $multiple ) { 587 // TODO: no stripslashing here? See ::populate(). 588 $qd[ $data->user_id ]->value[] = $data->value; 589 } 479 590 } 480 591 481 592 foreach ( $uncached_ids as $id ) { … … class BP_XProfile_ProfileData { 490 601 $d->id = ''; 491 602 $d->user_id = $id; 492 603 $d->field_id = $field_id; 493 $d->value = '';604 $d->value = $multiple ? array() : ''; 494 605 $d->last_updated = ''; 495 606 } 496 607 … … class BP_XProfile_ProfileData { 566 677 $field_sql .= $wpdb->prepare( "AND f.name = %s", $fields ); 567 678 } 568 679 569 $sql = $wpdb->prepare( "SELECT d.value, f.name FROM {$bp->profile->table_name_data} d, {$bp->profile->table_name_fields} f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id );680 $sql = $wpdb->prepare( "SELECT d.value, f.name, f.id FROM {$bp->profile->table_name_data} d, {$bp->profile->table_name_fields} f WHERE d.field_id = f.id AND d.user_id = %d AND f.parent_id = 0 $field_sql", $user_id ); 570 681 $values = $wpdb->get_results( $sql ); 571 682 683 // TODO: checking for empty result/WP_Error, but not in other methods? 572 684 if ( empty( $values ) || is_wp_error( $values ) ) { 573 685 return false; 574 686 } … … class BP_XProfile_ProfileData { 579 691 for ( $i = 0, $count = count( $values ); $i < $count; ++$i ) { 580 692 for ( $j = 0; $j < count( $fields ); $j++ ) { 581 693 if ( $values[$i]->name == $fields[$j] ) { 582 $new_values[$fields[$j]] = $values[$i]->value; 694 $multiple = bp_xprofile_field_supports_multiple_values( $values[$i]->id ); 695 696 // TODO: no stripslashing here? See ::populate() 697 if ( ! isset( $new_values[ $fields[$j] ] ) ) { 698 if ( $multiple ) { 699 $new_values[$fields[$j]] = ( array() === $values[$i]->value ) ? array() : array( $values[$i]->value ); 700 } else { 701 $new_values[$fields[$j]] = $values[$i]->value; 702 } 703 } elseif ( $multiple ) { 704 $new_values[$fields[$j]][] = $values[$i]->value; 705 } 583 706 } elseif ( !array_key_exists( $fields[$j], $new_values ) ) { 584 707 $new_values[$fields[$j]] = NULL; 585 708 } 586 709 } 587 710 } 588 711 } else { 589 $new_values = $values[0]->value; 712 713 // Collect multiple values in array 714 // TODO: no stripslashing here? See ::populate() 715 if ( bp_xprofile_field_supports_multiple_values( $values[0]->id ) ) { 716 $new_values = wp_list_pluck( $values, 'value' ); 717 718 // Parse empty list 719 if ( array() === maybe_unserialize( $new_values[0] ) ) { 720 $new_values = array(); 721 } 722 } else { 723 $new_values = $values[0]->value; 724 } 590 725 } 591 726 592 727 return $new_values; … … class BP_XProfile_ProfileData { 651 786 * 652 787 * @since 1.0.0 653 788 * 654 * @param int $user_id User ID to query for.655 * @param string $exclude_fullname SQL portion used to exclude by field ID.789 * @param int $user_id User ID to query for. 790 * @param bool $exclude_fullname Optional. Whether to exclude the fullname field. Defaults to false. 656 791 * @return array|null|object 657 792 */ 658 public static function get_random( $user_id, $exclude_fullname ) {793 public static function get_random( $user_id, $exclude_fullname = false ) { 659 794 global $wpdb; 660 795 661 796 $exclude_sql = ! empty( $exclude_fullname ) ? ' AND pf.id != 1' : ''; 662 797 663 798 $bp = buddypress(); 664 799 665 return $wpdb->get_results( $wpdb->prepare( "SELECT pf.type, pf.name, pd.value FROM {$bp->profile->table_name_data} pd INNER JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id AND pd.user_id = %d {$exclude_sql} ORDER BY RAND() LIMIT 1", $user_id ) ); 800 $rand_sql = "SELECT id FROM {$bp->profile->table_name_fields} ORDER BY RAND() LIMIT 1"; 801 $result = $wpdb->get_results( $wpdb->prepare( "SELECT pf.type, pf.name, pd.value, pf.id FROM {$bp->profile->table_name_data} pd INNER JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id AND pd.user_id = %d {$exclude_sql} WHERE pf.id IN ($rand_sql)", $user_id ) ); 802 803 // Collect multiple values in array 804 if ( bp_xprofile_field_supports_multiple_values( $result[0]->id ) ) { 805 // TODO: no stripslashing here? See ::populate() 806 $result[0]->value = wp_list_pluck( $result, 'value' ); 807 808 // Parse empty list 809 if ( array() === maybe_unserialize( $result[0]->value ) ) { 810 $result[0]->value = array(); 811 } 812 813 $result = array( $result[0] ); 814 } 815 816 return $result; 666 817 } 667 818 668 819 /**
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)