Changeset 34522
- Timestamp:
- 09/24/2015 09:21:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-functions.php
r34446 r34522 689 689 function check_comment_flood_db( $ip, $email, $date ) { 690 690 global $wpdb; 691 if ( current_user_can( 'manage_options' ) ) 692 return; // don't throttle admins 691 // don't throttle admins or moderators 692 if ( current_user_can( 'manage_options' ) || current_user_can( 'moderate_comments' ) ) { 693 return; 694 } 693 695 $hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS ); 694 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 ) ) ) { 696 697 if ( is_user_logged_in() ) { 698 $user = get_current_user_id(); 699 $check_column = '`user_id`'; 700 } else { 701 $user = $ip; 702 $check_column = '`comment_author_IP`'; 703 } 704 705 $sql = $wpdb->prepare( 706 "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( $check_column = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1", 707 $hour_ago, 708 $user, 709 $email 710 ); 711 $lasttime = $wpdb->get_var( $sql ); 712 if ( $lasttime ) { 695 713 $time_lastcomment = mysql2date('U', $lasttime, false); 696 714 $time_newcomment = mysql2date('U', $date, false);
Note: See TracChangeset
for help on using the changeset viewer.