Q:

limitation on number of post comments

I want to define a limitation (maximum 100) on the number of activity comments/replies. So when an activity's total comments reaches 100, then automatically commenting get disabled.
However I'm trying to apply this filter on buddypress activities, I didn't find anything related to this topic about wordpress posts neither.
Any help will be really appreciated.

A:

I never used buddypress but in wordpress you could use the comments_open-filter in your functions.php
add_filter( 'comments_open', 'my_comments_open', 10, 2 );
function my_comments_open( $open, $post_id ) {
    if ( wp_count_comments( $post_id ) >= 100 )
        $open = false;
    return $open;
}

