We just upgraded from 1.67 to 1.70 and now our ReCaptcha doesn’t appear. I found the code that caused the issue. In google-captcha.php line 560, the old code was: ! isset( $gglcptch_options[ $form_slug ] ) || The new code is: isset( $gglcptch_options[ $form_slug ] ) &&
In my custom page I use: apply_filters( ‘gglcptch_display_recaptcha’, ” ); This is the code that stopped working after the upgrade. Modifying that line 560 back to the old code fixed the issue.
Could you please describe your problem in more detail? What WordPress version do you use? What problem do you have and after which actions? Provide a link or screenshots to the page where the problem occurs. Since it is not clear what are you talking about.
WordPress Version is 6.1.1. When we used version 1.67 of this plugin, this code on the page worked great:
<?php $check_result = apply_filters( 'gglcptch_verify_recaptcha', true, 'string' );
if ( true === $check_result ) { /* the reCAPTCHA answer is right */
echo'REcaptcha has been submitted successfully';
} elseif ( false === $check_result) { /* the reCAPTCHA answer is wrong or there are some other errors */
echo "Something went wrong with ReCaptcha. Please try again or refresh the page.";
} else {
echo 'For your security, please use ReCaptcha below, then you will be directed to the login form.';
echo '<form name="FormSubmit" method="POST" class="check-elig">';
echo apply_filters( 'gglcptch_display_recaptcha', '' );
echo '<input name="FormSubmit" type="submit" value="Submit" id="FormSubmit" />
</form>';
}
?>
After upgrading to version 1.70, that code does not work any more. The Plugin returns a “1” instead of “blank”, which makes my “if” statements invalid. If I look in your plugin’s source code, I found this change:
the old code was:
! isset( $gglcptch_options[ $form_slug ] ) ||
The new code is:
isset( $gglcptch_options[ $form_slug ] ) &&
If I change the code back to the old way, everything works fine, but I, of course, don’t want to modify plugin code. I can’t provide a link because it’s on a Development box. We make sure everything works in Development before making it live on our Production Server. I’ve attached screenshots of what is looks like with the old plugin versus the new plugin.
Due to the expansion of the list of plugins that are compatible with our reСaptcha, we had to make changes to the compatibility with custom forms. We have updated the instructions for working with reCaptcha in custom forms.
I looked at the code you directed me to and that doesn’t really apply to my situation. It sounds like you simply no longer allow the 3 options, true, false, or null. You only allow 2 options True or Null/False.
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Returning 1 instead of blank variable’ is closed to new replies.