Reply To: Disable commenting on Mentions in Profile
Surprise! 😀
Here are two functions to achieve your needs. The first can handle several comment possibilities on different activity types.
You can use the second if you only want to deactivate ONE activity type.
May this help !
If you need to deactivate comments for several activity types.
function bpfr_remove_updates_commenting($can_comment) {
//defining the context
if($can_comment == true) :
$can_comment = bp_get_activity_action_name();
//just in case of...
if(empty($can_comment))
return;
//handling the activity types we want to disable
//to get other activity type names, go to the DB and check the "type" column in xx_bp_activity table
switch($can_comment){
case 'bbp_reply_create': // type name
$can_comment = ! ('bbp_reply_create');
break;
case 'activity_update': // type name
$can_comment = ! ('activity_update');
break;
}
//action !
return $can_comment;
//context end here
endif;
}
add_filter('bp_activity_can_comment', 'bpfr_remove_updates_commenting');
This function handles only one activity type: bbp_create_reply. In this example, a topic activity can no more be commented from within the activity screen.
function bpfr_remove_bbp_reply_activity_commenting($can_comment) {
if ($can_comment == true) {
$can_comment = ! ('bbp_reply_create' == bp_get_activity_action_name());
}
return $can_comment;
}
add_filter('bp_activity_can_comment', 'bpfr_remove_bbp_reply_activity_commenting');