WordPress.org

Make WordPress Core

Ticket #10931: 10931.diff

File 10931.diff, 1.4 KB (added by greuben, 3 years ago)
  • wp-includes/comment.php

     
    13301330        $commentdata['comment_date_gmt'] = current_time('mysql', 1); 
    13311331 
    13321332        $commentdata = wp_filter_comment($commentdata); 
    1333  
    1334         $commentdata['comment_approved'] = wp_allow_comment($commentdata); 
    1335  
     1333         
    13361334        $comment_ID = wp_insert_comment($commentdata); 
    13371335 
    13381336        do_action('comment_post', $comment_ID, $commentdata['comment_approved']); 
  • wp-comments-post.php

     
    8585 
    8686$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; 
    8787 
    88 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 
     88$comment_approved = wp_allow_comment($commentdata); 
     89if( get_user_by( 'email', $comment_author_email ) && 'spam' !== $comment_approved ) 
     90        $comment_approved = 0; 
    8991 
     92$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent', 'user_ID'); 
     93 
    9094$comment_id = wp_new_comment( $commentdata ); 
    9195 
    9296$comment = get_comment($comment_id);