Reply To: Updated solution to removing @mentions
To remove @username near the header avatar on profile page, use this (in bp-custom.php)
function bpfr_remove_mention_from_profile() {
// hide the hardcoded @ sign and username
echo '<style> h2.user-nicename { display:none; } </style>';
if( bp_is_user() && ! bp_get_member_user_id() ) {
$user_id = 'displayed: '. bp_displayed_user_id();
} else {
$user_id = 'get_member_user: '. bp_get_member_user_id();
}
remove_filter( 'bp_get_displayed_user_mentionname', bp_activity_get_user_mentionname( bp_displayed_user_id() ) );
}
add_filter( 'bp_get_displayed_user_mentionname', 'bpfr_remove_mention_from_profile' );
To remove the mention sub tab from profile page, use this (in bp-custom.php):
function bpfr_hide_mention( $retval = 1 ) {
$retval = false;
// condition
if ( bp_is_user() && ! bp_is_my_profile() ) {
$retval = true;
}
return $retval;
}
function bpfr_hide_mention_nav() {
// stop if condition is not ok
if ( ! bpfr_hide_mention() ) {
return;
}
// otherwise we remove the nav item
//bp subnav items
bp_core_remove_subnav_item( 'activity', 'mentions' );
}
add_action( 'bp_ready', 'bpfr_hide_mention_nav' );
To unlink @mention (this removes only the link not the mentionned username) AND remove the public message button, use this (in bp-custom.php):
add_filter( 'bp_activity_do_mentions', '__return_false' );
To allow the new BP 2.1 @mention tool in bbPress, use this (in bp-custom.php):
function bpfr_bbpress_maybe_load_mentions_scripts( $retval = false ) {
if ( function_exists( 'bbpress' ) && is_bbpress() ) {
$retval = true;
}
return $retval;
}
add_filter( 'bp_activity_maybe_load_mentions_scripts', 'bpfr_bbpress_maybe_load_mentions_scripts' );
Tested with WP 4.1 – BP 2.1.1 – bbP 2.5.4