Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disable commenting on Mentions in Profile


  • Doremdou
    Participant

    @doremdou

    Hi 🙂

    I would like to disable commenting on mentions notifications/activities, how could I do that please? 🙂

    Because I am using bbpress with Buddypress, and when someone mentions me for example in his topic, I’ve got a notification on my profile.
    Some people on my website are directly replying and commenting to those notifications in their activity feed BUT… their answers are not showing in the forum (bbpress) topic like this! they are just commenting activies so it is useless and no one will ever see their answers on the forum.

    Can someone help? If possible I would like to disable all commenting possiblities on activity feed but keep the comment button only on: activity only notes (for example “what’s new”) and groups activities.

    Thank you very much!

    PS: sorry for my english I am trying to do my best to explain ^^
    Thanks
    Dorem

Viewing 2 replies - 1 through 2 (of 2 total)

  • danbp
    Participant

    @danbp

    @doremdou,

    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');
    

    Doremdou
    Participant

    @doremdou

    Hello, thank you very much for your help @danbp I will test this when I am back home ^^

    PS: aren’t you the Dan on the FR BP website? you are everywhere haha!
    Thank you again you are awesome 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable commenting on Mentions in Profile’ is closed to new replies.
Skip to toolbar