• Resolved Imidg

    (@imidg)


    Since some update of ContactForm7, plugin no longer works. ??
    I need to use ReCaptcha v2, but instead script of ReCaptcha v3 is loaded.

    As I discover, you don’t deregister previous script of ContactForm7, which is loading v3.
    See /wp-content/plugins/wpcf7-recaptcha/recaptcha-v2.php
    Lines 75. You just trying register again
    wp_register_script( 'google-recaptcha', $url, array(), '2.0', true ); But after some update it doesn’t work anymore.

    After I added lines of dequeue&&deregister:

    wp_dequeue_script( 'google-recaptcha' );
    wp_deregister_script('google-recaptcha');

    before lines 75, plugin start work properly.

    Please update your plugin.
    See line 75 and change it to:

    wp_dequeue_script( 'google-recaptcha' );
    wp_deregister_script('google-recaptcha');
    wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
    wp_enqueue_script( 'google-recaptcha', $url, array(), '2.0', true );

    Thanks in advance!

    • This topic was modified 5 years, 2 months ago by Imidg.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author IQComputing

    (@iqcomputing)

    Hello,

    Instead of dequeueing the script we remove the action hook that runs the enqueue. Whenever the plugin is loaded it adds the action wpcf7_recaptcha_enqueue_scripts. Then whenever the theme is being setup we remove the hook and add our own hook iqfix_wpcf7_recaptcha_enqueue_scripts. You can see this in recaptcha-v2.php LN 22.

    https://plugins.trac.www.ads-software.com/browser/wpcf7-recaptcha/trunk/recaptcha-v2.php#L22

    Whenever you installed the plugin, did you select in the setting to use reCaptcha v2 as the source?

    https://ps.w.org/wpcf7-recaptcha/assets/screenshot-1.jpg?rev=2153682

    One thing we can do is add a lower priority to our add action hook so, for whatever reason the Contact Form 7 hook can not be removed we can reserve the google-recaptcha handle before Contact Form 7 can use it. It would pretty much be an additional fail-safe. This is something we can push in our next update.

    Thread Starter Imidg

    (@imidg)

    Instead of dequeueing the script we remove the action hook that runs the enqueue.

    It makes some sense, but didn’t work for me.

    Whenever you installed the plugin, did you select in the setting to use reCaptcha v2 as the source?

    Yes, I did.
    Anyway, everything was working before. Just after some update of ContactForm7 plugin, it stop to work.

    One thing we can do is add a lower priority to our add action hook

    Yes! It works.
    I reinstall your plugin. ReCaptcha was lost again in contact forms.
    But after I change priority on line 24
    https://plugins.trac.www.ads-software.com/browser/wpcf7-recaptcha/trunk/recaptcha-v2.php#L24 like that:
    add_action( 'wp_enqueue_scripts', 'iqfix_wpcf7_recaptcha_enqueue_scripts', 9 );
    Everything is fine now.

    So, please, do change priority, because it make plugin work again (at least in my case).

    Thanks for help!

    • This reply was modified 5 years, 2 months ago by Imidg.
    Plugin Author IQComputing

    (@iqcomputing)

    Hello,

    We just wanted to check in and let you know that we’ve pushed an update with the lower priority update added in. You can download the latest version of ReCaptcha v2 for Contact Form 7 from the main plugin page. Hopefully this solves your issue, thanks for the report. Have a wonderful rest of your week!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin no longer works’ is closed to new replies.