Ticket #15215: 3.1-wp_count_comments.patch

File 3.1-wp_count_comments.patch, 772 bytes (added by tfnab, 2 years ago)

Alternative way of fixing this; patch for 3.1 which has the same issue

  • comment.php

     
    892892 
    893893        $total = 0; 
    894894        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed'); 
    895         $known_types = array_keys( $approved ); 
    896895        foreach ( (array) $count as $row ) { 
    897896                // Don't count post-trashed toward totals 
    898897                if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) 
    899898                        $total += $row['num_comments']; 
    900                 if ( in_array( $row['comment_approved'], $known_types ) ) 
     899                if ( isset($approved[$row['comment_approved']]) ) 
    901900                        $stats[$approved[$row['comment_approved']]] = $row['num_comments']; 
    902901        } 
    903902