Are you at a dead-end researching & trying to resolve the issue with Buddypress @mentions & Display names? Then I have a simple solution to your problem.
Let’s first take a look at what the problem is here:
Buddypress features @mentions that make it easy for any member to mention another member’s name in his/her status update however all across your network, @mentions work ONLY with members’ Usernames and not their Display names. Now, we all know that members on a Buddypress network are always listed using their Display names, not Usernames.
This is a problem because if I know a member on the network I will naturally know him/her by their Display name and when I try to mention them in my update, it won’t work because Buddypress will not understand my @mention in the Display name form.
For example, if my friend’s Username is Karen and her Display name is Weblogic, it’s obvious that I would know her by the name I see her using on the network which is Weblogic but if I try to mention her in my update using @Weblogic, it’s NOT going to work.
Further, by some means if I manage to get members’ Usernames to be listed across the site instead of their Display names, another plugin I’m using for auto-suggesting member names – BP Labs- will fail to work because it fetches members’ Display names & not Usernames. So you can see, these two issues are mutually conflicting but there’s a 2 step solution to this problem as follows.
Install the Buddypress Usernames Only plugin. This will make sure all your network members are listed by their Usernames throughout the site, not their Display names as they appear by default. So now your members remember each other by their Usernames as those are the names that they will now see around. As a courtesy to your new sign ups, you can add a tip like “Your Username is your Display name so choose carefully.” on your sign up form just below the Username field so they know what’s going to happen and can choose a name wisely.
The next step is making it even easier for your members to use @mentions by adding an auto-suggest feature just like on Facebook where once you start typing @ followed by any letter, you get a list of possible mentions including your friends’ names so that instead of typing their entire name, you can simply click on the right one of the suggestions populated.
For this, download & install the BP-Labs plugin. This plugin populates a list of possible names for you to mention. The only problem is when you start typing @ followed by a friend’s Username, it produces an option list showing members’ Display names. Now since after step 1, members will be familiar with others’ Usernames & not Display names, this again poses a problem.
What we need is for BP-Labs to populate a list showing members’ Usernames instead.
To make this work, open this file inside the BP- Labs plugin directory – bp-labs/beakers/class-bplabs-autosuggest.php
Find this line
$result->name = bp_core_get_user_displayname( $user->ID );
and change it to
$result->name = bp_core_get_username( $user->ID );
That’s it! Your Buddypress network is now ready to start using @mentions effectively!