Introduction
By default, BuddyBoss uses the user’s nickname when opening the direct message composer from a user profile. If you prefer to use the actual username instead, you can apply a small custom code change in your active theme.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- In your WordPress admin dashboard, go to Appearance > Theme Editor.
- Under Select theme to edit, choose your active theme (preferably BuddyBoss Child Theme), then click Select.
- From the Theme Files list, click Theme Functions (functions.php).
- Paste the following code just before the closing PHP tag (?>):
function bb_override_button_message() {
return apply_filters(
'bp_get_send_private_message_link',
wp_nonce_url(
bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( bp_displayed_user_id() )
)
);
}
add_filter( 'bp_get_send_private_message_link', 'bb_override_button_message' );
- Click Update File to save your changes.
Troubleshooting and FAQs
Q: The message button still uses the nickname, what should I check?
A: Make sure the code is in the active theme’s functions.php and clear any caches.
Q: Should I add this code to the parent theme or child theme?
A: Use a child theme to avoid losing changes during updates.
Q: Will this affect existing messages?
A: No, it only changes how the recipient is populated when clicking the Message button.
Q: Can I revert this change easily?
A: Yes, remove the code from functions.php and save.
Q: Who can I contact for further assistance?
A: Check the BuddyBoss Support Policy or consult a developer.