Skip to:
Content

BuddyPress.org

Changeset 7999


Ignore:
Timestamp:
02/27/2014 08:20:25 PM (10 years ago)
Author:
r-a-y
Message:

Don't query friendship status in BP_User_Query for logged-out users.

The bp_friends_filter_user_query_populate_extras() function is used to
add the confirmed friendship status against the logged-in user to the
existing user query.

However, we don't need to run this query if a user isn't logged in.

See #5435.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-filters.php

    r7558 r7999  
    99
    1010/**
    11  * Filter BP_User_Query::populate_extras to override each queried users fullname.
     11 * Filter BP_User_Query::populate_extras to add confirmed friendship status.
     12 *
     13 * Each member in the user query is checked for confirmed friendship status
     14 * against the logged-in user.
    1215 *
    1316 * @since BuddyPress (1.7.0)
     
    2225function bp_friends_filter_user_query_populate_extras( BP_User_Query $user_query, $user_ids_sql ) {
    2326    global $bp, $wpdb;
     27
     28    // stop if user isn't logged in
     29    if ( ! is_user_logged_in() ) {
     30        return;
     31    }
    2432
    2533    // Fetch whether or not the user is a friend of the current user
Note: See TracChangeset for help on using the changeset viewer.