Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/12/2014 12:04:06 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Update phpdoc and add some brackets to xprofile_set_field_data() and xprofile_get_field_data().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-functions.php

    r8798 r8799  
    295295 * Fetches profile data for a specific field for the user.
    296296 *
    297  * When the field value is serialized, this function unserializes and filters each item in the array
    298  * that results.
     297 * When the field value is serialized, this function unserializes and filters
     298 * each item in the array.
    299299 *
    300300 * @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 user
     301 * @param mixed $field         The ID of the field, or the $name of the field.
     302 * @param int $user_id         The ID of the user
    303303 * @param string $multi_format How should array data be returned? 'comma' if you want a
    304  *   comma-separated string; 'array' if you want an array
     304 *                             comma-separated string; 'array' if you want an array
    305305 * @uses BP_XProfile_ProfileData::get_value_byid() Fetches the value based on the params passed.
    306306 * @return mixed The profile field data.
     
    308308function xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' ) {
    309309
    310         if ( empty( $user_id ) )
     310        if ( empty( $user_id ) ) {
    311311                $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 ) ) {
    317319                $field_id = $field;
    318         else
     320        } else {
    319321                $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        }
    323327
    324328        $values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) );
     
    345349 * @package BuddyPress Core
    346350 * @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
    349354 * @uses xprofile_get_field_id_from_name() Gets the ID for the field based on the name.
    350355 * @return bool True on success, false on failure.
     
    352357function xprofile_set_field_data( $field, $user_id, $value, $is_required = false ) {
    353358
    354         if ( is_numeric( $field ) )
     359        if ( is_numeric( $field ) ) {
    355360                $field_id = $field;
    356         else
     361        } else {
    357362                $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        }
    361368
    362369        $field          = new BP_XProfile_Field( $field_id );
Note: See TracChangeset for help on using the changeset viewer.