Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with Contact Form 7 integration #57

Open
Rage-X opened this issue Nov 30, 2015 · 18 comments
Open

Bug with Contact Form 7 integration #57

Rage-X opened this issue Nov 30, 2015 · 18 comments

Comments

@Rage-X
Copy link

Rage-X commented Nov 30, 2015

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
Copy link
Contributor

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
Copy link
Author

Rage-X commented Nov 30, 2015

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
Copy link
Author

Rage-X commented Nov 30, 2015

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

@mcguffin
Copy link
Contributor

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
Copy link
Author

Rage-X commented Nov 30, 2015

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!

mcguffin added a commit that referenced this issue Nov 30, 2015
@beherit
Copy link

beherit commented Dec 17, 2015

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
Copy link

fmp777 commented Jan 26, 2016

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
Copy link

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
Copy link

ghost commented Nov 8, 2016

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
Copy link

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
Copy link

ghost commented Feb 6, 2017

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
Copy link

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
Copy link

beherit commented Mar 8, 2017

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
Copy link

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

@beherit
Copy link

beherit commented Mar 11, 2017

@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
Copy link

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

@srihari906
Copy link

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
Copy link

AvelPostol commented Jun 3, 2023

Ваши ответы не актуальны для 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>
И ВСЕ РАБОТАЕТ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants