Skip to:
Content

BuddyPress.org

Ticket #5950: 5950.02.patch

File 5950.02.patch, 1.7 KB (added by imath, 10 years ago)
  • src/bp-friends/bp-friends-functions.php

    diff --git src/bp-friends/bp-friends-functions.php src/bp-friends/bp-friends-functions.php
    index 0e4a402..ba51c23 100644
    add_action( 'bp_make_spam_user', 'friends_remove_data' ); 
    575575 * @see bp_activity_mentions_script()
    576576 */
    577577function bp_friends_prime_mentions_results() {
    578         if ( ! bp_activity_maybe_load_mentions_scripts() ) {
     578        $user_id = get_current_user_id();
     579
     580        // Bail if mentions scripts are disable or current user has many friends
     581        if ( ! bp_activity_maybe_load_mentions_scripts() || 100 < (int) friends_get_total_friend_count( $user_id ) ) {
    579582                return;
    580583        }
    581584
    function bp_friends_prime_mentions_results() { 
    584587                'populate_extras' => false,
    585588
    586589                'type'            => 'alphabetical',
    587                 'user_id'         => get_current_user_id(),
     590                'user_id'         => $user_id,
    588591        );
    589592
    590593        $friends_query = new BP_User_Query( $friends_query );
    function bp_friends_prime_mentions_results() { 
    594597                $result        = new stdClass();
    595598                $result->ID    = $user->user_nicename;
    596599                $result->image = bp_core_fetch_avatar( array( 'html' => false, 'item_id' => $user->ID ) );
    597                 $result->name  = bp_core_get_user_displayname( $user->ID );
     600
     601                if ( ! empty( $user->display_name ) ) {
     602                        $result->name = $user->display_name;
     603                } else {
     604                        $result->name  = bp_core_get_user_displayname( $user->ID );
     605                }
    598606
    599607                $results[] = $result;
    600608        }
    function bp_friends_prime_mentions_results() { 
    603611                'friends' => $results,
    604612        ) );
    605613}
    606 add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_results' );
    607  No newline at end of file
     614add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_results' );