Support » Plugin: reCAPTCHA in WP comments form » reCAPTCHA validation does not work and POST button remains disabled

  • Resolved jj458

    (@jjowens)


    I installed this plugin today and had a problem where after checking the “I’m not a Robot” box, or validating the image question the “POST” button in my WordPress comments form would remain ‘disabled’.

    Debugging showed that the json response returned error “invalid-json”. I did some research and came across this issue in the github repository for google’s reCaptcha: https://github.com/google/recaptcha/issues/359 . There they explained there was a change few months back in the response from Google. The same post points a workaround which is to use ‘CurlPost’ instead of ‘SocketPost’.

    I’m not sure why I was blessed with this issue, but after a while trying to figure out where to make this change I realized it can be done by updating line 183 of file …/includes/recaptcha.php:

    From:
    $reCaptcha = new \ReCaptcha\ReCaptcha($secret);

    To:
    $reCaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\CurlPost());

    This plugin appears to be working for me now and the Post button in my comments section is disabled after the verification is complete.

    I hope this is of some use to you in case you find similar issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jj458

    (@jjowens)

    To add, I also had to implement a change to allow this plugin to work properly on google chrome. The change I made was on file …/js/recaptcha.js line 80:

    From:

    if ( ( ajaxResponse.status === 200 ) && ( ajaxResponse.readyState === 4 ) && ( ajaxResponse.statusText === “OK” ) ) {

    To:

    if ( ( ajaxResponse.status === 200 ) && ( ajaxResponse.readyState === 4 ) && (( ajaxResponse.statusText === “OK” )||(ajaxResponse.statusText === “”)) ) {

    This was necessary because for some reason Google (and now Edge) returns an empty value in statusText, while Firefox returns “OK” in the same field.

    Good luck.

    Plugin Author jmviade

    (@jmviade)

    jj458,

    Thanks a lot for your comment.
    I will implement this change in the next version this week.
    Best,

    Joan Miquel

    I am experiencing the same problem after just installing and configuring accordingly.

    thanks for the code fix @jjowens ! hopefully this will make it into an official plugin update soon.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.