Skip to:
Content

BuddyPress.org

Changeset 9101


Ignore:
Timestamp:
10/29/2014 05:19:07 AM (10 years ago)
Author:
djpaul
Message:

Mentions: for pre-cached result, use displayname if profile sync is enabled.

This should cut down on numbers of SQL queries made in certain
situations where a user on a site has many friends (whose user details
are not in WP’s object cache).

See #5950

File:
1 edited

Legend:

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

    r8754 r9101  
    595595        $result->ID    = $user->user_nicename;
    596596        $result->image = bp_core_fetch_avatar( array( 'html' => false, 'item_id' => $user->ID ) );
    597         $result->name  = bp_core_get_user_displayname( $user->ID );
     597
     598        if ( ! empty( $user->display_name ) && ! bp_disable_profile_sync() ) {
     599            $result->name = $user->display_name;
     600        } else {
     601            $result->name = bp_core_get_user_displayname( $user->ID );
     602        }
    598603
    599604        $results[] = $result;
Note: See TracChangeset for help on using the changeset viewer.