WordPress.org

Make WordPress Core

Ticket #5690: 5690.diff

File 5690.diff, 1.5 KB (added by Speedboxer, 7 years ago)

Don't check for comment flooding if the User is an Admin (manage_options_

  • wp-includes/comment.php

     
    376376 * @param unknown_type $date {@internal Missing Description}} 
    377377 */ 
    378378function check_comment_flood_db( $ip, $email, $date ) { 
    379         global $wpdb; 
    380         if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) { 
    381                 $time_lastcomment = mysql2date('U', $lasttime); 
    382                 $time_newcomment  = mysql2date('U', $date); 
    383                 $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); 
    384                 if ( $flood_die ) { 
    385                         do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment); 
    386                         wp_die( __('You are posting comments too quickly.  Slow down.') ); 
     379        if ( !current_user_can('manage_options') ) { 
     380                global $wpdb; 
     381                if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$ip' OR comment_author_email  
     382= '$email' ORDER BY comment_date DESC LIMIT 1") ) { 
     383                        $time_lastcomment = mysql2date('U', $lasttime); 
     384                        $time_newcomment  = mysql2date('U', $date); 
     385                        $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); 
     386                        if ( $flood_die ) { 
     387                                do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment); 
     388                                wp_die( __('You are posting comments too quickly.  Slow down.') ); 
     389                        } 
    387390                } 
    388391        } 
    389392}