diff --git bp-activity/bp-activity-classes.php bp-activity/bp-activity-classes.php
index 0155ed8..818c990 100644
|
|
class BP_Activity_Activity { |
950 | 950 | } |
951 | 951 | } |
952 | 952 | |
| 953 | // Calculate depth for each item |
| 954 | foreach ( $ref as &$r ) { |
| 955 | $depth = 1; |
| 956 | $parent_id = $r->secondary_item_id; |
| 957 | while ( $parent_id !== $r->item_id ) { |
| 958 | $depth++; |
| 959 | $parent_id = $ref[ $parent_id ]->secondary_item_id; |
| 960 | } |
| 961 | $r->depth = $depth; |
| 962 | } |
| 963 | |
953 | 964 | // If we cache a value of false, it'll count as a cache |
954 | 965 | // miss the next time the activity comments are fetched. |
955 | 966 | // Storing the string 'none' is a hack workaround to |
diff --git bp-activity/bp-activity-template.php bp-activity/bp-activity-template.php
index c574302..d41a742 100644
|
|
function bp_activity_comments( $args = '' ) { |
1749 | 1749 | * |
1750 | 1750 | * @since BuddyPress (1.2) |
1751 | 1751 | * |
1752 | | * @todo remove $counter global |
1753 | | * |
1754 | 1752 | * @param object $comment The activity object currently being recursed |
1755 | 1753 | * |
1756 | 1754 | * @global object $activities_template {@link BP_Activity_Template} |
… |
… |
function bp_activity_comment_count() { |
2103 | 2101 | } |
2104 | 2102 | |
2105 | 2103 | /** |
| 2104 | * Output the depth of the current activity comment. |
| 2105 | * |
| 2106 | * @since BuddyPress (2.0.0) |
| 2107 | */ |
| 2108 | function bp_activity_comment_depth() { |
| 2109 | echo bp_activity_get_comment_depth(); |
| 2110 | } |
| 2111 | /** |
| 2112 | * Return the current activity comment depth. |
| 2113 | * |
| 2114 | * @since BuddyPress (2.0.0) |
| 2115 | * |
| 2116 | * @return int |
| 2117 | */ |
| 2118 | function bp_activity_get_comment_depth() { |
| 2119 | global $activities_template; |
| 2120 | return apply_filters( 'bp_activity_get_comment_depth', $activities_template->activity->current_comment->depth ); |
| 2121 | } |
| 2122 | |
| 2123 | /** |
2106 | 2124 | * Output the activity comment link. |
2107 | 2125 | * |
2108 | 2126 | * @since BuddyPress (1.2) |
… |
… |
function bp_activity_can_comment() { |
2603 | 2621 | function bp_activity_can_comment_reply( $comment ) { |
2604 | 2622 | $can_comment = true; |
2605 | 2623 | |
| 2624 | if ( get_option( 'thread_comments' ) && bp_activity_get_comment_depth() >= get_option( 'thread_comments_depth' ) ) { |
| 2625 | $can_comment = false; |
| 2626 | } |
| 2627 | |
2606 | 2628 | return apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment ); |
2607 | 2629 | } |
2608 | 2630 | |
diff --git bp-templates/bp-legacy/buddypress-functions.php bp-templates/bp-legacy/buddypress-functions.php
index 0cb3153..ea7b13b 100644
|
|
function bp_legacy_theme_new_activity_comment() { |
692 | 692 | $activities_template->activity = new stdClass(); |
693 | 693 | $activities_template->activity->id = $activities_template->activities[0]->item_id; |
694 | 694 | $activities_template->activity->current_comment = $activities_template->activities[0]; |
| 695 | |
| 696 | // Because the whole tree has not been loaded, we manually |
| 697 | // determine depth |
| 698 | $depth = 1; |
| 699 | $parent_id = $activities_template->activities[0]->secondary_item_id; |
| 700 | while ( $parent_id !== $activities_template->activities[0]->item_id ) { |
| 701 | $depth++; |
| 702 | $p_obj = new BP_Activity_Activity( $parent_id ); |
| 703 | $parent_id = $p_obj->secondary_item_id; |
| 704 | } |
| 705 | $activities_template->activity->current_comment->depth = $depth; |
695 | 706 | } |
696 | 707 | |
697 | 708 | // get activity comment template part |