Make WordPress Core

Ticket #13792: ticket.13792.diff

File ticket.13792.diff, 1.6 KB (added by pauldewouters, 10 years ago)
  • src/wp-admin/includes/class-wp-comments-list-table.php

    diff --git src/wp-admin/includes/class-wp-comments-list-table.php src/wp-admin/includes/class-wp-comments-list-table.php
    index 5803b1d..f70f467 100644
    class WP_Comments_List_Table extends WP_List_Table { 
    478478
    479479                                $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
    480480
    481                                 $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
     481                                $comment_depth = $this->get_comment_depth( $comment );
     482                                $thread_comments = (bool)get_option( 'thread_comments' );
     483                                $max_depth = (int)get_option( 'thread_comments_depth' );
     484                                if ( ( $max_depth && $thread_comments ) && ( $comment_depth < $max_depth ) ) {
     485                                        $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
     486                                }
     487
    482488                        }
    483489
    484490                        /** This filter is documented in wp-admin/includes/dashboard.php */
    class WP_Comments_List_Table extends WP_List_Table { 
    506512                }
    507513        }
    508514
     515        public function get_comment_depth( $comment ) {
     516
     517                if ( 0 == $comment->comment_parent ) {
     518                        return 1;
     519                }
     520
     521                while ( 0 != $comment->comment_parent ) {
     522                        $comment = get_comment( $comment->comment_parent );
     523                        $depth++;
     524                }
     525
     526                return $depth;
     527        }
     528
    509529        public function column_author( $comment ) {
    510530                global $comment_status;
    511531