[buddypress-trac] [BuddyPress] #1870: Limit number of levels of threaded replies

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sun Nov 28 16:18:32 UTC 2010


#1870: Limit number of levels of threaded replies
--------------------+-------------------------------------------------------
 Reporter:  ousep   |       Owner:     
     Type:  defect  |      Status:  new
 Priority:  minor   |   Milestone:  1.3
Component:  Core    |     Version:     
 Keywords:          |  
--------------------+-------------------------------------------------------
Changes (by boonebgorges):

  * component:  => Core


Comment:

 I'm about to commit a fix that works as follows. It adds a new function
 bp_activity_can_comment_reply() which, by default, always returns true.
 You can filter the output of that function to limit reply depth in the
 following way:

 {{{
 function test_comment_depth_limit( $can_comment, $comment ) {
         if ( $comment->mptt_left > 3 )
                 $can_comment = false;

         return $can_comment;
 }
 add_filter( 'bp_activity_can_comment_reply', 'test_comment_depth_limit',
 10, 2 );
 }}}

 $comment->mptt_left refers the number of items to the left of the comment
 in the comment tree, including the original activity item. So this filter
 will limit comment depth to two levels (> 3).

-- 
Ticket URL: <http://trac.buddypress.org/ticket/1870#comment:2>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list