WordPress.org

Make WordPress Core

Changeset 2561


Ignore:
Timestamp:
04/20/2005 09:56:28 PM (13 years ago)
Author:
matt
Message:

Dupe comment check - http://mosquito.wordpress.org/view.php?id=1265

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-post.php

    r2556 r2561  
    486486    }
    487487
     488    // Simple duplicate check
     489    $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$author' ";
     490    if ( $email ) $dupe .= "OR comment_author_email = '$email' ";
     491    $dupe .= ") AND comment_content = '$comment' LIMIT 1";
     492    if ( $wpdb->get_var($dupe) )
     493        die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
     494
    488495    // Simple flood-protection
    489496    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") ) {
Note: See TracChangeset for help on using the changeset viewer.