ABOUT WP Simple Captcha

lots of robot spam commenters,i really get rid of them,hope it will not cost much.so I write this little plugin to do the work,you can just add these lines of code into your theme’s function.php file ,put them before the last:

?>

it will just work.

these are the code you should put into your function.php:>

class zxdRoboCheck{
  function zxd_robokiller_fields($fields) {
    $rnum1 =rand(1,10);
    $rnum2 = rand(2,8);
    $rnum = $rnum1 + $rnum2;
    $fields['robo'] = '<p class="comment-form-robo"><label for="robo">'.$rnum1.'+'.$rnum2.'=?'.__('(robot check)').'</label> <span class="required">*</span><input id="robo" name="robo" type="text" value="" size="30" aria-required="true" /><input id="rnum" name="rnum" type="hidden" value="'.$rnum.'" size="0" aria-required="true" class="hide" /></p> ';
    return $fields;
  }
  function roboCheck($comment){
                $userId = get_current_user_id();
                if($userId!=0) return($comment);
    if (empty($_POST['robo']) || trim($_POST['robo']) == '' ) {
      wp_die( __('Error: you are not robot,are you?do the math,fill the blank '));
    }
    $robo_num1 = (int)$_POST['robo'];
    $robo_num2 = (int)$_POST['rnum'];
    if ( $robo_num2 == $robo_num1) {
      return($comment);
    } 
    else {
      wp_die( __('Error: you are not robot,are you?'));
    }
  }
}
if (class_exists("zxdRoboCheck")) {
  $aRoboCheck = new zxdRoboCheck();
  add_action('comment_form_default_fields', array(&$aRoboCheck, 'zxd_robokiller_fields'),1);
  add_filter('preprocess_comment', array(&$aRoboCheck, 'roboCheck'), 1);
}

FAQ

it is simple,so it is easy to crack,if spammers want.lets just hope they do not really have to deal with your site.

DOWNLOAD

http://wordpress.org/extend/plugins/wp-simple-captcha/

CHANGE LOG

1.1 fix login user can not comment bug.