How to Remove @mentions from BuddyPress

How to Remove @mentions from BuddyPress

This tip comes to you courtesy of r-a-y, one of the BuddyPress forums moderators. He outlined three steps to removing @mentions in a recent thread on the forums:

Step 1: Remove the filter:

Add this to your theme’s functions.php file:

// removes @mention links in updates, forum posts, etc.
remove_filter( 'bp_activity_new_update_content', 'bp_activity_at_name_filter' );
remove_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' );
remove_filter( 'pre_comment_content', 'bp_activity_at_name_filter' );
remove_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' );
remove_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' );
remove_filter( 'bp_activity_comment_content', 'bp_activity_at_name_filter' );

// remove @mention email notifications
remove_action( 'bp_activity_posted_update', 'bp_activity_at_message_notification', 10, 3 );
remove_action( 'bp_groups_posted_update', 'groups_at_message_notification', 10, 4 );

Step 2: Remove the subnav:

Add this to your theme’s functions.php file:

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

function ray_remove_mention_nav() {
global $bp;

bp_core_remove_subnav_item( $bp->activity->slug, 'mentions' );
}
add_action( 'init', 'ray_remove_mention_nav' );

Step 3: Remove the hardcoded menu item:

Copy over /bp-default/activity/index.php to your child theme and remove the hardcoded li#activity-mentions from /activity/index.php.

R-a-y mentioned that he might turn this into a plugin if anyone is interested. Stop over to this thread and let him know how much you like his hack. :)