WordPress.org

Make WordPress Core

Ticket #7927: 7927.7.patch

File 7927.7.patch, 2.2 KB (added by Viper007Bond, 10 years ago)

Missing parenthesis in patch 5

  • wp-includes/comment-template.php

     
    730730 * @return null Returns null if no comments appear
    731731 */
    732732function comments_template( $file = '/comments.php', $separate_comments = false ) {
    733         global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity;
     733        global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
    734734
    735735        if ( ! (is_single() || is_page() || $withcomments) )
    736736                return;
     
    762762                $comments_by_type = &$wp_query->comments_by_type;
    763763        }
    764764
    765         if ( '' == get_query_var('cpage') && get_option('page_comments') && 'newest' == get_option('default_comments_page') )
     765        $overridden_cpage = FALSE;
     766        if ( '' == get_query_var('cpage') && get_option('page_comments') && 'newest' == get_option('default_comments_page') ) {
    766767                set_query_var( 'cpage', get_comment_pages_count() );
     768                $overridden_cpage = TRUE;
     769        }
    767770
    768771        define('COMMENTS_TEMPLATE', true);
    769772
     
    11291132 * @param array $comments Optional array of comment objects.  Defaults to $wp_query->comments
    11301133 */
    11311134function wp_list_comments($args = array(), $comments = null ) {
    1132         global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt;
     1135        global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage;
    11331136
    11341137        $comment_alt = $comment_thread_alt = 0;
    11351138        $comment_depth = 1;
     
    11581161                if ( empty($comments) ) {
    11591162                        $r['page'] = get_query_var('cpage');
    11601163                } else {
    1161                         $threaded = ( -1 == $r['depth'] ) ? false : true;
    1162                         $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($comments, $r['per_page'], $threaded) : 1;
    1163                         set_query_var( 'cpage', $r['page'] );
     1164                        if ( empty($overridden_cpage) ) {
     1165                                $r['page'] = get_query_var('cpage');
     1166                        } else {
     1167                                $threaded = ( -1 == $r['depth'] ) ? false : true;
     1168                                $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($comments, $r['per_page'], $threaded) : 1;
     1169                                set_query_var( 'cpage', $r['page'] );
     1170                        }
    11641171                }
    11651172        }
    11661173        // Validation check