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:

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. :)

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.