// Check the recaptcha on WordPress MU function check_recaptcha_wpmu($result) { global $_POST, $recaptcha_opt; // must make a check here, otherwise the wp-admin/user-new.php script will keep trying to call // this function despite not having called do_action('signup_extra_fields'), so the recaptcha // field was never shown. this way it won't validate if it's called in the admin interface if (!is_admin()) { // It's blogname in 2.6, blog_id prior to that if (isset($_POST['blog_id']) || isset($_POST['blogname'])) return $result; // no text entered if (empty($_POST['recaptcha_response_field']) || $_POST['recaptcha_response_field'] == '') { $result['errors']->add('blank_captcha', $recaptcha_opt['error_blank']); return $result; } $response = recaptcha_check_answer($recaptcha_opt['privkey'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] ); // incorrect CAPTCHA if (!$response->is_valid) if ($response->error == 'incorrect-captcha-sol') { $result['errors']->add('captcha_wrong', $recaptcha_opt['error_incorrect']); echo "
". $recaptcha_opt['error_incorrect'] . "
"; } } return $result; }