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:
{code type=php}
// 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 );
{/code}

Step 2: Remove the subnav:

Add this to your theme’s functions.php file:
{code type=php}
function ray_remove_mention_nav() {
global $bp;

bp_core_remove_subnav_item( $bp->activity->slug, ‘mentions’ );
}
add_action( ‘init’, ‘ray_remove_mention_nav’ );
{/code}

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