Top

Daily Tip: How to Remove @mentions from BuddyPress

September 22, 2010

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

Tweet This Post

Because this plugin/widget is provided free of charge, I simply ask you to link back to Pressography.com in a post on your blog, or from one of your sites. It doesn't need to be anything fancy - just a note saying that you're using it, and whether or not you like it. However, there is no requirement that you do this, you're free to use the plugin regardless.

Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.