Make WordPress Core


Ignore:
Timestamp:
10/04/2004 08:49:45 AM (21 years ago)
Author:
saxmatt
Message:

Kitten's emergent registration / comment whitelisting patch.

File:
1 edited

Legend:

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

    r1734 r1737  
    14741474
    14751475function check_comment($author, $email, $url, $comment, $user_ip) {
     1476    global $wpdb;
     1477
    14761478    if (1 == get_settings('comment_moderation')) return false; // If moderation is set to manual
    14771479
     
    14791481        return false; // Check # of external links
    14801482
    1481     if ('' == trim( get_settings('moderation_keys') ) ) return true; // If moderation keys are empty
    1482     $words = explode("\n", get_settings('moderation_keys') );
     1483    // Comment whitelisting:
     1484    if ( 1 == get_settings('comment_whitelist')) {
     1485        $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author_email = '$email' and comment_approved = '1' ");
     1486        if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) )
     1487            return true
     1488    return false;
     1489    }
     1490
     1491    $mod_keys = trim( get_settings('moderation_keys') );
     1492    if ('' == $mod_keys )
     1493        return true; // If moderation keys are empty
     1494    $words = explode("\n", $mod_keys );
     1495
    14831496    foreach ($words as $word) {
    14841497        $word = trim($word);
Note: See TracChangeset for help on using the changeset viewer.