--- ../temp/recaptcha-wordpress-2.7/recaptcha.php 2007-11-30 00:02:31.000000000 +0000
+++ recaptcha.php 2007-12-05 22:02:28.000000000 +0000
@@ -15,6 +15,23 @@
#doesn't need to be secret, just shouldn't be used by any other code.
define ("RECAPTCHA_WP_HASH_SALT", "b7e0638d85f5d7f3694f68e944136d62");
+function recaptcha_init ()
+{
+ global $user_level;
+ get_currentuserinfo();
+ $recaptcha_opt = get_option('plugin_recaptcha');
+
+ if (!$recaptcha_opt['allowusers'] ||
+ ($user_level <= $recaptcha_opt['userlevel'])) {
+ add_action( 'comment_form', 'recaptcha_comment_form' );
+ add_filter('wp_head', 'recaptcha_wp_saved_comment',0);
+ add_filter('preprocess_comment', 'recaptcha_wp_check_comment',0);
+ add_filter('comment_post_redirect', 'recaptcha_wp_relative_redirect',0,2);
+ }
+}
+
+add_action('init', 'recaptcha_init');
+
function recaptcha_wp_hash_comment ($id)
{
global $recaptcha_opt;
@@ -62,8 +79,6 @@
}
-add_action( 'comment_form', 'recaptcha_comment_form' );
-
function recaptcha_wp_show_captcha_for_comment () {
global $user_ID;
@@ -157,10 +172,6 @@
return $uri['host'];
}
-add_filter('wp_head', 'recaptcha_wp_saved_comment',0);
-add_filter('preprocess_comment', 'recaptcha_wp_check_comment',0);
-add_filter('comment_post_redirect', 'recaptcha_wp_relative_redirect',0,2);
-
function recaptcha_wp_add_options_to_admin() {
if (function_exists('add_options_page')) {
add_options_page('reCAPTCHA', 'reCAPTCHA', 8, plugin_basename(__FILE__), 'recaptcha_wp_options_subpanel');
@@ -172,6 +183,8 @@
$optionarray_def = array(
'pubkey' => '',
'privkey' => '',
+ 'allowusers' => '',
+ 'userlevel' => '',
);
add_option('plugin_recaptcha', $optionarray_def, 'reCAPTCHA Options');
@@ -181,6 +194,8 @@
$optionarray_update = array (
'pubkey' => $_POST['recaptcha_opt_pubkey'],
'privkey' => $_POST['recaptcha_opt_privkey'],
+ 'allowusers' => (int)$_POST['recaptcha_opt_allowusers'],
+ 'userlevel' => (int)$_POST['recaptcha_opt_userlevel'],
);
update_option('plugin_recaptcha', $optionarray_update);
}
@@ -219,6 +234,14 @@
+
+
+ " />
+
+
+
+
+