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' ); |
575 | 575 | * @see bp_activity_mentions_script() |
576 | 576 | */ |
577 | 577 | function 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 ) ) { |
579 | 582 | return; |
580 | 583 | } |
581 | 584 | |
… |
… |
function bp_friends_prime_mentions_results() { |
584 | 587 | 'populate_extras' => false, |
585 | 588 | |
586 | 589 | 'type' => 'alphabetical', |
587 | | 'user_id' => get_current_user_id(), |
| 590 | 'user_id' => $user_id, |
588 | 591 | ); |
589 | 592 | |
590 | 593 | $friends_query = new BP_User_Query( $friends_query ); |
… |
… |
function bp_friends_prime_mentions_results() { |
594 | 597 | $result = new stdClass(); |
595 | 598 | $result->ID = $user->user_nicename; |
596 | 599 | $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 | } |
598 | 606 | |
599 | 607 | $results[] = $result; |
600 | 608 | } |
… |
… |
function bp_friends_prime_mentions_results() { |
603 | 611 | 'friends' => $results, |
604 | 612 | ) ); |
605 | 613 | } |
606 | | add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_results' ); |
607 | | No newline at end of file |
| 614 | add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_results' ); |