Changeset 8201
- Timestamp:
- 03/29/2014 12:40:28 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-classes.php
r8187 r8201 1008 1008 } 1009 1009 1010 // Calculate depth for each item 1011 foreach ( $ref as &$r ) { 1012 $depth = 1; 1013 $parent_id = $r->secondary_item_id; 1014 while ( $parent_id !== $r->item_id ) { 1015 $depth++; 1016 $parent_id = $ref[ $parent_id ]->secondary_item_id; 1017 } 1018 $r->depth = $depth; 1019 } 1020 1010 1021 // If we cache a value of false, it'll count as a cache 1011 1022 // miss the next time the activity comments are fetched. -
trunk/bp-activity/bp-activity-template.php
r8190 r8201 1798 1798 * @since BuddyPress (1.2) 1799 1799 * 1800 * @todo remove $counter global1801 *1802 1800 * @param object $comment The activity object currently being recursed 1803 1801 * … … 2152 2150 2153 2151 /** 2152 * Output the depth of the current activity comment. 2153 * 2154 * @since BuddyPress (2.0.0) 2155 */ 2156 function bp_activity_comment_depth() { 2157 echo bp_activity_get_comment_depth(); 2158 } 2159 /** 2160 * Return the current activity comment depth. 2161 * 2162 * @since BuddyPress (2.0.0) 2163 * 2164 * @return int 2165 */ 2166 function bp_activity_get_comment_depth() { 2167 global $activities_template; 2168 return apply_filters( 'bp_activity_get_comment_depth', $activities_template->activity->current_comment->depth ); 2169 } 2170 2171 /** 2154 2172 * Output the activity comment link. 2155 2173 * … … 2652 2670 $can_comment = true; 2653 2671 2672 if ( get_option( 'thread_comments' ) && bp_activity_get_comment_depth() >= get_option( 'thread_comments_depth' ) ) { 2673 $can_comment = false; 2674 } 2675 2654 2676 return apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment ); 2655 2677 } -
trunk/bp-templates/bp-legacy/buddypress-functions.php
r8150 r8201 773 773 $activities_template->activity->id = $activities_template->activities[0]->item_id; 774 774 $activities_template->activity->current_comment = $activities_template->activities[0]; 775 776 // Because the whole tree has not been loaded, we manually 777 // determine depth 778 $depth = 1; 779 $parent_id = $activities_template->activities[0]->secondary_item_id; 780 while ( $parent_id !== $activities_template->activities[0]->item_id ) { 781 $depth++; 782 $p_obj = new BP_Activity_Activity( $parent_id ); 783 $parent_id = $p_obj->secondary_item_id; 784 } 785 $activities_template->activity->current_comment->depth = $depth; 775 786 } 776 787 -
trunk/tests/testcases/activity/class.BP_Activity_Activity.php
r8131 r8201 394 394 $e2->user_fullname = bp_core_get_user_displayname( $e2->user_id ); 395 395 $e2->children = array(); 396 $e2->depth = 1; 396 397 397 398 $a3_obj = new BP_Activity_Activity( $a3 ); … … 411 412 $e3->user_fullname = bp_core_get_user_displayname( $e3->user_id ); 412 413 $e3->children = array(); 414 $e3->depth = 1; 413 415 414 416 $expected = array(
Note: See TracChangeset
for help on using the changeset viewer.