Skip to:
Content

BuddyPress.org

Changeset 6638


Ignore:
Timestamp:
12/15/2012 05:13:00 PM (11 years ago)
Author:
boonebgorges
Message:

In BP_User_Query, only parse the 'user_id' param if 'include' is empty

Friend request queries work by passing a list of requests to the 'include'
parameter of bp_has_members(). This conflicts necessarily with doing a
'user_id' check in BP_User_Query, because 'user_id' limits results to the
passed user's friends (which are, by definition, different from his friend
requests). Thus, when an 'include' param is passed, the 'user_id' check should
be skipped.

This replicates the same logic in BP_Core_User::get_users().

See #4060

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-classes.php

    r6574 r6638  
    297297
    298298        // 'user_id' - When a user id is passed, limit to the friends of the user
     299        // Only parse this if no 'include' param is passed, to account for
     300        // friend request queries
    299301        // @todo remove need for bp_is_active() check
    300         if ( !empty( $user_id ) && bp_is_active( 'friends' ) ) {
     302        if ( empty( $include ) && ! empty( $user_id ) && bp_is_active( 'friends' ) ) {
    301303            $friend_ids = friends_get_friend_user_ids( $user_id );
    302304            $friend_ids = $wpdb->escape( implode( ',', (array) $friend_ids ) );
    303305
    304             if ( !empty( $friend_ids ) ) {
     306            if ( ! empty( $friend_ids ) ) {
    305307                $sql['where'][] = "u.{$this->uid_name} IN ({$friend_ids})";
    306308
Note: See TracChangeset for help on using the changeset viewer.