WordPress.org

Make WordPress Core

Ticket #4618: 4618_trunk.diff

File 4618_trunk.diff, 1.6 KB (added by Nazgul, 7 years ago)
  • wp-includes/comment.php

     
    138138        if ( !isset($cache_lastcommentmodified[$timezone]) ) { 
    139139                switch ( strtolower($timezone)) { 
    140140                        case 'gmt': 
    141                                 $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1"); 
     141                                $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_date_gmt <= '$now' AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); 
    142142                                break; 
    143143                        case 'blog': 
    144                                 $lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1"); 
     144                                $lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_date_gmt <= '$now' AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); 
    145145                                break; 
    146146                        case 'server': 
    147                                 $lastcommentmodified = $wpdb->get_var("SELECT DATE_ADD(comment_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->comments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1"); 
     147                                $lastcommentmodified = $wpdb->get_var("SELECT DATE_ADD(comment_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->comments WHERE comment_date_gmt <= '$now' AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); 
    148148                                break; 
    149149                } 
    150150                $cache_lastcommentmodified[$timezone] = $lastcommentmodified;