Skip to:
Content

BuddyPress.org

Changeset 10920


Ignore:
Timestamp:
06/29/2016 09:21:42 PM (9 years ago)
Author:
r-a-y
Message:

XProfile: Return array if we pass $user_ids as an array in `BP_XProfile_ProfileData::get_value_byid().

Previously, in r10914, we changed the behavior to calculate whether we
should return a single result by counting the number of user IDs. This
created a PHP notice for some that are relying on the return value to be
an array instead of a string.

This commit reverts this behavior and renames the $is_single variable
to $return_single_result to better explain what is happening.

See r10914 (2.6-branch).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php

    r10914 r10920  
    439439        }
    440440
    441         $is_single = false;
    442         $user_ids  = wp_parse_id_list( $user_ids );
    443 
    444         if ( 1 === count( $user_ids ) ) {
    445             $is_single = true;
    446         }
     441        $return_single_result = false;
     442        if ( ! is_array( $user_ids ) ) {
     443            $return_single_result = true;
     444        }
     445
     446        $user_ids = wp_parse_id_list( $user_ids );
    447447
    448448        // Assemble uncached IDs.
     
    496496
    497497        // If a single ID was passed, just return the value.
    498         if ( $is_single ) {
     498        if ( $return_single_result ) {
    499499            return $data[0]->value;
    500500
Note: See TracChangeset for help on using the changeset viewer.