mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Line ending fixes and commenting cleanups from Scott Reilly
git-svn-id: https://develop.svn.wordpress.org/trunk@2556 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -480,6 +480,11 @@ function wp_new_comment( $commentdata, $spam = false ) {
|
||||
$now = current_time('mysql');
|
||||
$now_gmt = current_time('mysql', 1);
|
||||
|
||||
if ( $user_id ) {
|
||||
$userdata = get_userdata($user_id);
|
||||
$post_author = $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = '$comment_post_ID' LIMIT 1");
|
||||
}
|
||||
|
||||
// Simple flood-protection
|
||||
if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$user_ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) {
|
||||
$time_lastcomment = mysql2date('U', $lasttime);
|
||||
@@ -496,7 +501,9 @@ function wp_new_comment( $commentdata, $spam = false ) {
|
||||
$approved = 0;
|
||||
if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) )
|
||||
$approved = 'spam';
|
||||
|
||||
if ( $userdata && ( $user_id == $post_author || $userdata['user_level'] >= 9 ) )
|
||||
$approved = 1;
|
||||
|
||||
$approved = apply_filters('pre_comment_approved', $approved);
|
||||
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->comments
|
||||
@@ -589,4 +596,4 @@ function add_ping($post_id, $uri) { // Add a URI to those already pung
|
||||
return $wpdb->query("UPDATE $wpdb->posts SET pinged = '$new' WHERE ID = $post_id");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user