weDevsOfficial / wp-recaptcha-integration

WordPress reCaptcha integration supporting Ninja Forms and Contact Form 7
https://wordpress.org/plugins/wp-recaptcha-integration
50 stars 32 forks source link

Bug with Contact Form 7 integration #57

Open Rage-X opened 8 years ago

Rage-X commented 8 years ago

Upon installation of the plugin Contact Form 7's reCaptcha integration is broken. Attempted in incognito mode for the same results.

Steps to reproduce:

  1. Install Contact Form 7 plugin and enable reCaptcha integration - appears on form and works fine.
  2. Install WP reCaptcha Integration and activate settings
  3. Go to contact form page - reCaptcha box disappears even in incognito mode.
  4. Disable WP reCaptcha Integration and the reCaptcha box immediately re-appears on the contact form.
mcguffin commented 8 years ago

Are you sure you are not logged in? Incognito mode may resume an old session. You can also uncheck " Disable reCaptcha verification for logged in users." in the plugin settings.

Could also not follow the steps to reproduce. How could one enable reCaptcha Integration before installing the WP reCaptcha integration plugin?

Rage-X commented 8 years ago

The latest version of Contact Form 7 has its own reCaptcha integration function, independent of your plugin, I suspect there is some kind of conflict

Rage-X commented 8 years ago

I will try again when I'm back at my comp

mcguffin commented 8 years ago

I think got it: As long as you leave the CF7 recaptcha unconfigured, wp recaptcha will be in effect. You can reset the keys in the CF7 integration settings.

Having both captchas configured is not possible (yet). They will conflict, like you suspected.

Rage-X commented 8 years ago

Phew I'm glad I wasn't wasting your time XD

Also for others that are reading this, after I reset the keys in CF7 I have to click 'save' at the screen with blank fields, or CF7 will continue to remember the integration.

I'm leaving CF7 unconfigured for now, hope you're able to fix the compatibility in a future release :)

Your setup is still one of the most superior as it prevents the login button from being clicked - i.e. bots won't be able to do a brute force test. Most other reCaptcha plugins allow the login button to be click giving an indication on whether the write logins have been entered.

Thanks for the work that you're doing on this!

beherit commented 8 years ago

This bug is still exists. reCaptcha box some times doesn't show. I try to delete reCaptcha settings in CF7 but then captcha shortcode doesen't work.

fmp777 commented 8 years ago

Its true, since version 4.3 of Contact Form 7, this plugin conflicts and breaks all recaptcha functionality in CF7. The built-in recaptcha integration conflicts with this plugins shortcode [recaptcha]. The result is no captcha showing on the page, even if you have the CF7 "Integration" unconfigured.

I personally need this plugin's functionality so I had to revert CF7 back to 4.2 in order for everything to work as expected.

I'm not a wordpress developer, but might the fix be as simple as a custom shortcode tag for CF7?

fractaleater commented 8 years ago

I ran into CF7 4.3.1 recaptcha vanishing act after updating to WP4.4.2/ArtbeesJupiterTheme5.0.7.2 and WP reCaptcha Integration1.10. Recaptcha appeared on my login/comments/CF7 pages before the update. I am aware of how to work around my cache environment of cloudflare (enable development mode)/w3 total cache (clear all caches after every change)/Jupiter theme (clear theme cache after every change)/Google Chrome cache (use developer tools with Network/cache disabled).

After two days of hacking around, I found that if I completely uninstalled CF7 and reint1.10, installed CF7 with recaptcha integration configured, and installed reint1.10, well, recaptcha vanished when viewed in the front end. Variations on this scenario were ineffective.

What worked was to remove CF7 and reint1.10, install CF7 and add recaptcha integration, install Better WordPress reCAPTCHA: by Khang Minh – 2.0.3 and make sure to uncheck bwc2.0.3 "Add the recaptcha shortcode tag to your Contact Form 7 forms." Now my login/comment page are nocaptcha shielded along with my CF7 pages. I verified that the captcha shields access to these resources by attempting to send\login\comment without checking the nocaptcha. Only by checking the nocaptcha can resources be accessed. So everything is working as it was before the updates.

Sorry that I can't point you in the direction to what's wrong, but perhaps it is enough to present evidence that an alternative to reint1.10 works without issue? I suspect it might have had something to do with two instances of recaptcha api with different callbacks in the source urls. In the case of my working configuration, there are two instances as well, but no callbacks, and it looks like one of the sources is failing as Google chrome reports: www.gstatic.com/recaptcha/api2/r20160208154954/recaptcha__el.js:397 Uncaught Error: ReCAPTCHA placeholder element must be empty.

Thanks for your work on this plugin, and I hope you get things sorted out soon.

ghost commented 7 years ago

See issue with Contact Form 7 here: https://wordpress.org/support/topic/recaptcha-integration-error-invalid-recaptcha-client-id-0/#post-8411185

I have found a conflict between Contact Form 7 and WP reCaptcha Integration. They both use the global variable "grecaptcha".

When I deactivate WP reCaptcha Integration, the recaptcha on the contact form resets correctly and the thank you message appears.

Can this be tackled please?

ultimatejimmy commented 7 years ago

I was able to solve this in Contact Form 7 by adding an id and a class (I'm not sure which one did the trick) to the form [recaptcha] shortcode.

[recaptcha id="foobar" class="foobar"]

ghost commented 7 years ago

I have tested with a class on its own, then an id and with both, but no success: [recaptcha id:foobar class:foobar]

I have also tried your suggestion [recaptcha id="foobar" class="foobar"] but it did not work. I am not sure this is correct for CF7 shortcode anyway.

Were you able to reproduce the issue?

ultimatejimmy commented 7 years ago

Scratch that... I was trying a lot of things and I actually switched to another reCaptcha plugin: https://wordpress.org/plugins/simple-google-recaptcha/

beherit commented 7 years ago

Hi guys, I found a workaround for this bug - just simply add this code in e.g. functions.php in active theme:

function wp_recaptcha_cf7_fix($default) {
    global $post;
    if(is_a($post, 'WP_Post') && has_shortcode($post->post_content, 'contact-form-7')) {
        return false;
    }
    return $default;
}
add_filter('wp_recaptcha_do_scripts', 'wp_recaptcha_cf7_fix');
add_filter('wp_recaptcha_required', 'wp_recaptcha_cf7_fix');
aliabidi88 commented 7 years ago

@beherit i have used the above code you mentioned, but can't receive email of details

beherit commented 7 years ago

@aliabidi88 I don't know what You're talking about - this code only prevents to load captcha from this plugin on page where is shortcode [contact-form-7]. I think You have other bug which is not related with captcha.

dineshinau commented 6 years ago

@beherit It worked and fixed conflict with WP reCaptcha Integration on Contact Form 7.

srihari906 commented 5 years ago

reCaptcha V2 is working fine in all latest browsers except in IE9 and below, any one have fix please suggest me. thank you in advance

AvelPostol commented 1 year ago

Ваши ответы не актуальны для recaptchaV2 + wp + cf7. для cf7 есть специальный плагин для поддержки recaptchaV2, удаляйте из /puti/public_html/wp-content/plugins/wpcf7-recaptcha/recaptcha-v2.php код `

` И ВСЕ РАБОТАЕТ.