Ticket #2768: 2768.patch
File 2768.patch, 3.2 KB (added by , 14 years ago) |
---|
-
bp-activity/bp-activity-templatetags.php
691 691 return apply_filters( 'bp_activity_get_comments', $comments_html ); 692 692 } 693 693 /* TODO: The HTML in this function is temporary and will be moved to the template in a future version. */ 694 function bp_activity_recurse_comments( $comment ) {694 function bp_activity_recurse_comments( $comment, &$depth=0 ) { 695 695 global $activities_template, $bp; 696 696 697 697 if ( !$comment->children ) … … 702 702 if ( !$comment->user_fullname ) 703 703 $comment->user_fullname = $comment->display_name; 704 704 705 $depth++; 705 706 $content .= '<li id="acomment-' . $comment->id . '">'; 706 707 $content .= '<div class="acomment-avatar"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 20, 'height' => 20, 'email' => $comment->user_email ) ) . '</a></div>'; 707 708 $content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_acomment_name', $comment->user_fullname, $comment ) . '</a> · ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $comment->date_recorded ) ); 708 709 709 710 /* Reply link - the span is so that threaded reply links can be hidden when JS is off. */ 710 if ( is_user_logged_in() && bp_activity_can_comment_reply( $comment ) )711 if ( is_user_logged_in() && bp_activity_can_comment_reply( $comment, $depth ) ) 711 712 $content .= apply_filters( 'bp_activity_comment_reply_link', '<span class="acomment-replylink"> · <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>', $comment ); 712 713 713 714 /* Delete link */ … … 719 720 $content .= '</div>'; 720 721 $content .= '<div class="acomment-content">' . apply_filters( 'bp_get_activity_content', $comment->content ) . '</div>'; 721 722 722 $content .= bp_activity_recurse_comments( $comment );723 $content .= bp_activity_recurse_comments( $comment, $depth ); 723 724 $content .= '</li>'; 725 726 // If we're at the start of an activity loop, we'll be at the start of a new level of items, so reset the depth. 727 if ( 0 === $activities_template->current_activity ) 728 $depth = 0; 724 729 } 730 731 $depth = 0; 725 732 $content .= '</ul>'; 726 733 727 734 return apply_filters( 'bp_activity_recurse_comments', $content ); … … 952 959 return apply_filters( 'bp_activity_can_comment', $can_comment ); 953 960 } 954 961 955 function bp_activity_can_comment_reply( $comment ) {962 function bp_activity_can_comment_reply( $comment, $depth ) { 956 963 $can_comment = true; 957 964 958 return apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment ); 965 if ( get_option( 'thread_comments' ) && $depth >= get_option( 'thread_comments_depth' ) ) 966 $can_comment = false; 967 968 return apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment, $depth ); 959 969 } 960 970 961 971 function bp_activity_can_favorite() {