Changeset 8799 for trunk/src/bp-xprofile/bp-xprofile-functions.php
- Timestamp:
- 08/12/2014 12:04:06 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-xprofile/bp-xprofile-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-functions.php
r8798 r8799 295 295 * Fetches profile data for a specific field for the user. 296 296 * 297 * When the field value is serialized, this function unserializes and filters each item in the array298 * that results.297 * When the field value is serialized, this function unserializes and filters 298 * each item in the array. 299 299 * 300 300 * @package BuddyPress Core 301 * @param mixed $field The ID of the field, or the $name of the field.302 * @param int $user_id The ID of the user301 * @param mixed $field The ID of the field, or the $name of the field. 302 * @param int $user_id The ID of the user 303 303 * @param string $multi_format How should array data be returned? 'comma' if you want a 304 * comma-separated string; 'array' if you want an array304 * comma-separated string; 'array' if you want an array 305 305 * @uses BP_XProfile_ProfileData::get_value_byid() Fetches the value based on the params passed. 306 306 * @return mixed The profile field data. … … 308 308 function xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' ) { 309 309 310 if ( empty( $user_id ) ) 310 if ( empty( $user_id ) ) { 311 311 $user_id = bp_displayed_user_id(); 312 313 if ( empty( $user_id ) ) 314 return false; 315 316 if ( is_numeric( $field ) ) 312 } 313 314 if ( empty( $user_id ) ) { 315 return false; 316 } 317 318 if ( is_numeric( $field ) ) { 317 319 $field_id = $field; 318 else320 } else { 319 321 $field_id = xprofile_get_field_id_from_name( $field ); 320 321 if ( empty( $field_id ) ) 322 return false; 322 } 323 324 if ( empty( $field_id ) ) { 325 return false; 326 } 323 327 324 328 $values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) ); … … 345 349 * @package BuddyPress Core 346 350 * @param int|string $field The ID of the field, or the $name of the field. 347 * @param int|$user_id The ID of the user 348 * @param mixed The value for the field you want to set for the user. 351 * @param int|$user_id The ID of the user 352 * @param mixed $value The value for the field you want to set for the user. 353 * @param $is_required Whether or not the field is required 349 354 * @uses xprofile_get_field_id_from_name() Gets the ID for the field based on the name. 350 355 * @return bool True on success, false on failure. … … 352 357 function xprofile_set_field_data( $field, $user_id, $value, $is_required = false ) { 353 358 354 if ( is_numeric( $field ) ) 359 if ( is_numeric( $field ) ) { 355 360 $field_id = $field; 356 else361 } else { 357 362 $field_id = xprofile_get_field_id_from_name( $field ); 358 359 if ( empty( $field_id ) ) 360 return false; 363 } 364 365 if ( empty( $field_id ) ) { 366 return false; 367 } 361 368 362 369 $field = new BP_XProfile_Field( $field_id );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)