rodrigocc
Forum Replies Created
-
Forum: Plugins
In reply to: [SI CAPTCHA Anti-Spam] CAPTCHA not showing on lost password formHi!
I hit the same issue and did the quick&dirt patch implied from the original report: just c&p the si_captcha_register_form() function, check for lostpassword instead of register and call this new function.
This is, of course, a quick&dirty patch to make the trick. A proper patch would probably abstract the common parts in a new function that is called by the _lostpassword() and _register() functions. Or something like that 🙂
This patch works just fine for me. I searched https://ww.wp.xz.cn/plugins/si-captcha-for-wordpress/, http://www.642weather.com/weather/scripts.php and the .zip to find how to contribute to the project a patch, and I didn’t find anything. So I’m pasting it here, and hopefully it will be merged. If you know how to contribute (I honestly didn’t find it), please let me know.
Here is the diff: http://pastebin.com/EdQ5XGx7
And just in case the pastebin stops working, I’m pasting it here:
— si-captcha.php 2014-05-16 02:04:12.000000000 -0300
+++ ../si-captcha.php 2014-12-04 11:35:01.216246350 -0300
@@ -483,6 +483,40 @@
return true;
} // end function si_captcha_register_form+function si_captcha_lostpassword_form() {
+ global $si_captcha_url, $si_captcha_opt;
+
+ if ($si_captcha_opt[‘si_captcha_lostpwd’] != ‘true’) {
+ return true; // captcha setting is disabled for registration
+ }
+
+// Test for some required things, print error message right here if not OK.
+if ($this->si_captcha_check_requires()) {
+
+ $si_aria_required = ($si_captcha_opt[‘si_captcha_aria_required’] == ‘true’) ? ‘ aria-required=”true” ‘ : ”;
+
+// the captcha html – register form
+echo ‘
+
+<div ‘;
+echo ($si_captcha_opt[‘si_captcha_captcha_small’] == ‘true’) ? ‘class=”captchaSizeDivSmall”‘ : ‘class=”captchaSizeDivLarge”‘;
+echo ‘>’;
+$this->si_captcha_captcha_html(‘si_image_reg’,’reg’);
+echo ‘</div>
+<p>
+ <label>’;
+ echo ($si_captcha_opt[‘si_captcha_label_captcha’] != ”) ? $si_captcha_opt[‘si_captcha_label_captcha’] : __(‘CAPTCHA Code’, ‘si-captcha’);
+ echo ‘
+<input id=”captcha_code” name=”captcha_code” class=”input” type=”text” value=”” tabindex=”30″ ‘.$si_aria_required.’ style=”font-size: 24px; width: 97%; padding: 3px; margin-top: 2px; margin-right: 6px; margin-bottom: 16px; border: 1px solid #e5e5e5; background: #fbfbfb;” /></label>
+</p>
+
+’;
+}
+
+ return true;
+} // end function si_captcha_lostpassword_form
+
+
// for wpmu and buddypress before 1.1
function si_captcha_wpmu_signup_form( $errors ) {
global $si_captcha_url, $si_captcha_opt;
@@ -1237,7 +1271,7 @@
}if ($si_captcha_opt[‘si_captcha_lostpwd’] == ‘true’) {
– add_action(‘lostpassword_form’, array( &$si_image_captcha, ‘si_captcha_register_form’), 10);
+ add_action(‘lostpassword_form’, array( &$si_image_captcha, ‘si_captcha_lostpassword_form’), 10);
add_action(‘lostpassword_post’, array( &$si_image_captcha, ‘si_captcha_lostpassword_post’), 10);
}@@ -1248,4 +1282,4 @@
register_uninstall_hook(__FILE__, ‘si_captcha_unset_options’);
}-// end of file
\ No newline at end of file
+// end of file