X

How to Add @mention Username Under bbPress User Avatars

Snippets by IsItWP

Are you looking for a way to display a user @mention name directly below their avatar within a bbPress forum topic? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add @mention username under bbPress user avatars.

Instructions:

All you have to do is add this code to your theme’s bp-custom.php file:

function wps_at_mention(){
    echo '<span class="bbp-user-nicename"><span class="handle-sign">@</span>'. bp_core_get_username(bbp_get_reply_author_id(bbp_get_reply_id())) .'</span>' ;
}
add_action( 'bbp_theme_after_reply_author_details', 'wps_at_mention' );

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 9 best WordPress job board plugins and how to create a multi-page form in WordPress.

Comments   Leave a Reply

  1. Awesome, it worked!

    Thank you very much…

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!