Ticket #2172: 2172-1.patch
| File 2172-1.patch, 1.6 KB (added by , 15 years ago) |
|---|
-
bp-xprofile.php
597 597 * 598 598 * Fetches profile data for a specific field for the user. 599 599 * 600 * When the field value is serialized, this function unserializes and filters each item in the array 601 * that results. 602 * 600 603 * @package BuddyPress Core 601 * @param $field The ID of the field, or the $name of the field.602 * @param $user_id The ID of the user604 * @param mixed $field The ID of the field, or the $name of the field. 605 * @param int $user_id The ID of the user 603 606 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 604 * @uses BP_XProfile_ProfileData::get_value_by fieldname() Fetches the value based on the params passed.605 * @return The profile field data.607 * @uses BP_XProfile_ProfileData::get_value_byid() Fetches the value based on the params passed. 608 * @return mixed The profile field data. 606 609 */ 607 610 function xprofile_get_field_data( $field, $user_id = null ) { 608 611 global $bp; … … 625 628 if ( !$field_id ) 626 629 return false; 627 630 628 return apply_filters( 'xprofile_get_field_data', BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) ); 631 $values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) ); 632 633 if ( is_array( $values ) ) { 634 $data = array(); 635 foreach( (array)$values as $value ) { 636 $data[] = apply_filters( 'xprofile_get_field_data', $value ); 637 } 638 } else { 639 $data = apply_filters( 'xprofile_get_field_data', $values ); 640 } 641 642 return $data; 629 643 } 630 644 631 645 /**