Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disable comments in activity


  • webbuild
    Participant

    @vproios

    Hello i have buddypress 2.4.3 and i want to disable comments in activity . I add this code in functions.php of my theme
    add_filter(‘bp_activity_can_comment’,’__return_false’);

    but the comments still exist.
    How can i disable the comments and make the button invisible from site-wide activity ?

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

  • danbp
    Moderator

    @danbp

    Hi,
    Comments who are already registered in activities stay in the feed. If you don’t want to see them, you have to remove them manually in the activity manager.

    Once an activity comment is deactivated, the button isn’t visible in the feed.

    Try this method and add the code to bp-custom.php, so you stay also theme independant.

    function bpfr_activity_nocomment( $can_comment = true, $type = '' ) {
            if ( empty( $can_comment ) ) {
                    return $can_comment;
            }
     
            //handling the activity types we want to disable
    	//to get activity type names, go to the DB and check the "type" column in xx_bp_activity table	
            $cant_comment_types = array( 
    	   'new_forum_topic' => 1,
    	   'new_forum_post' => 1,
            );
     
            return ! isset( $cant_comment_types[ $type ] );
    }
    add_filter( 'bp_activity_can_comment', 'bpfr_activity_nocomment', 10, 2 );

    webbuild
    Participant

    @vproios

    Hi
    bp-custom.php put only this code?
    i putt in wp-content-plugin ?
    i put the code in this route but not work

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