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

Allow Contact Form 7 5.7+ integration and use recaptcha placeholder w… #391

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

softmanro
Copy link

This patch allows Contact Form 7 5.7+ integration and use reCaptcha placeholder when used in conjunction with ReCaptcha v2 for Contact Form 7 plugin https://wordpress.org/plugins/wpcf7-recaptcha/.

If you find this patch useful, I believe the article on your website https://complianz.io/why-the-wp-consent-api-is-important-a-case-study-with-cf7-and-recaptcha/ could be amended to account for such an integration.

I have tested this using Contact Form 7 version 5.7.4 and version 1.4.3 of the reCaptcha v2 plugin.

Please let me know if you need additional details.

…hen used in conjunction with ReCaptcha v2 for Contact Form 7 plugin
@softmanro
Copy link
Author

softmanro commented Mar 3, 2023

One important note: in order for the above to work properly a small patch for the wpcf7-recaptcha plugin is also needed, I will try to discuss with that plugin's maintainer about it. I will leave it here for reference:

--- wpcf7-recaptcha-1.4.3/recaptcha-v2.php  2022-07-29 14:41:02.000000000 +0300
+++ wpcf7-recaptcha-1.4.3-patched/recaptcha-v2.php  2023-03-01 13:37:58.000000000 +0200
@@ -129,7 +129,7 @@
        wpcf7_form_controls_class( $tag->type, 'g-recaptcha' ) );
    $atts['id'] = $tag->get_id_option();

-   $html = sprintf( '<span %1$s></span>', wpcf7_format_atts( $atts ) );
+   $html = sprintf( '<div %1$s></div>', wpcf7_format_atts( $atts ) );
    $html .= iqfix_wpcf7_recaptcha_noscript(
        array( 'sitekey' => $atts['data-sitekey'] ) );
    $html = sprintf( '<span class="wpcf7-form-control-wrap recaptcha" data-name="recaptcha">%s</span>', $html );

@rlankhorst
Copy link
Collaborator

@softmanro Thanks for your input! We have tried in the past to communicate with the developer of Contact Form 7, to no avail. At that point he didn't really see the need for privacy compliance, and didn't believe it even was necessary for reCaptcha.

One of the reasons we dropped the integration was that three times in a very short time, Contact Form 7 did a breaking change to the javascript. As we manage about 120 plugin integrations and 30 service integrations, we only add integrations if:

  • the plugin is stable / not changing every few weeks with breaking changes
  • and/or the developer is willing to work together on maintaining the integration
  • the plugin has a large user base.

Otherwise we have a continuous influx of support requests about broken integrations, which is a challenge as it is. In the case of CF7, only the third condition applies.

For this reason, I don't expect the developer to be cooperative for the required change. If he doesn't, merging this isn't a good idea. As alternative, this could be changed into an mu-plugin, like we do here, for smaller use cases:
https://github.com/really-simple-plugins/complianz-integrations

But first, let's see if the CF7 dev responds, and if so, that might be a sign that something has changed in the privacy vision of Contact Form 7, and it might be worth our while to add an integration in the plugin itself.

Rogier

@rlankhorst
Copy link
Collaborator

@softmanro I have created a mu-plugin which you can try. I thought it might need a dependency, as this is what it included originally, but you can comment that part out in the code if necessary:

https://github.com/Really-Simple-Plugins/complianz-integrations/blob/master/contact-form-7.php

It's not tested, but this can be a base for further changes.

As the CF7 developer does not seem to be interested in working together on this, I think this is the best we can do at the moment.

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

Successfully merging this pull request may close these issues.

2 participants