WordPress.org

Make WordPress Core

Ticket #21609: 21609.patch

File 21609.patch, 875 bytes (added by andy, 3 years ago)

Add comment_parent to duplicate comment check

  • wp-includes/comment.php

     
    636636 
    637637        // Simple duplicate check 
    638638        // expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content) 
    639         $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' "; 
     639        $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_parent = '$comment_parent' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' "; 
    640640        if ( $comment_author_email ) 
    641641                $dupe .= "OR comment_author_email = '$comment_author_email' "; 
    642642        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";