WordPress.org

Make WordPress Core

Ticket #4366: 4366.diff

File 4366.diff, 1.0 KB (added by mdawaffe, 5 years ago)
  • wp-includes/comment.php

     
    550550        global $wpdb; 
    551551        if ( current_user_can( 'manage_options' ) ) 
    552552                return; // don't throttle admins 
    553         if ( $lasttime = $wpdb->get_var( $wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = %s OR comment_author_email = %s ORDER BY comment_date DESC LIMIT 1", $ip, $email) ) ) { 
     553        $hour_ago = gmdate( 'Y-m-d H:i:s', time() - 3600 ); 
     554        if ( $lasttime = $wpdb->get_var( $wpdb->prepare( "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( `comment_author_IP` = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1", $hour_ago, $ip, $email ) ) ) { 
    554555                $time_lastcomment = mysql2date('U', $lasttime, false); 
    555556                $time_newcomment  = mysql2date('U', $date, false); 
    556557                $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);