wp-recaptcha-integration icon indicating copy to clipboard operation
wp-recaptcha-integration copied to clipboard

Bug with Contact Form 7 integration

Open Rage-X opened this issue 10 years ago • 18 comments

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.

Rage-X avatar Nov 30 '15 07:11 Rage-X

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?

mcguffin avatar Nov 30 '15 10:11 mcguffin

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 avatar Nov 30 '15 11:11 Rage-X

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

Rage-X avatar Nov 30 '15 11:11 Rage-X

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.

mcguffin avatar Nov 30 '15 12:11 mcguffin

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!

Rage-X avatar Nov 30 '15 12:11 Rage-X

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.

beherit avatar Dec 17 '15 19:12 beherit

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?

fmp777 avatar Jan 26 '16 18:01 fmp777

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.

fractaleater avatar Feb 16 '16 22:02 fractaleater

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?

ghost avatar Nov 08 '16 17:11 ghost

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"]

ultimatejimmy avatar Feb 03 '17 16:02 ultimatejimmy

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?

ghost avatar Feb 06 '17 11:02 ghost

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

ultimatejimmy avatar Feb 06 '17 14:02 ultimatejimmy

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');

beherit avatar Mar 08 '17 19:03 beherit

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

aliabidi88 avatar Mar 10 '17 23:03 aliabidi88

@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.

beherit avatar Mar 11 '17 08:03 beherit

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

dineshinau avatar Apr 04 '18 18:04 dineshinau

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

srihari906 avatar Dec 26 '18 05:12 srihari906

Ваши ответы не актуальны для recaptchaV2 + wp + cf7. для cf7 есть специальный плагин для поддержки recaptchaV2, удаляйте из /puti/public_html/wp-content/plugins/wpcf7-recaptcha/recaptcha-v2.php код <noscript> <div class="grecaptcha-noscript"> <iframe src="<?php echo esc_url( $url ); ?>" frameborder="0" scrolling="no" width="310" height="430"> </iframe> <textarea name="g-recaptcha-response" rows="3" cols="40" placeholder="<?php esc_attr_e( 'reCaptcha Response Here', 'wpcf7-recaptcha' ); ?>"> </textarea> </div> </noscript> И ВСЕ РАБОТАЕТ.

AvelPostol avatar Jun 03 '23 16:06 AvelPostol