andrewlimaza / caldera-forms-anti-spam

Caldera Forms Anti Spam WordPress plugin. This adds Google's reCAPTCHA field to your Caldera Form.
https://wordpress.org/plugins/cf-anti-spam/
25 stars 16 forks source link

Support conditional loading #17

Closed martin-braun closed 4 years ago

martin-braun commented 4 years ago

I'd like to use this plugin to protect my Caldera Forms, but I want the user to consent the use of the plugin, before loading it (incl. any access to google.com and gstatic.com) to fulfill strict privacy regulations in EU (GDPR), Germany (DSGVO), etc.

Unfortunately, adding a "Show" condition to the reCaptcha element will error out:

Uncaught Error: reCAPTCHA placeholder element must be an element or id
    at Object.ot [as render] (recaptcha__en.js:501)
    at init_recaptcha_fld_3499907_1 ((index):1148)
    at HTMLDocument.<anonymous> ((index):1158)
    at HTMLDocument.dispatch (jquery.js?ver=1.12.4-wp:3)
    at HTMLDocument.r.handle (jquery.js?ver=1.12.4-wp:3)
    at Object.trigger (jquery.js?ver=1.12.4-wp:3)
    at Object.a.event.trigger (jquery-migrate.min.js?ver=1.4.1:2)
    at HTMLDocument.<anonymous> (jquery.js?ver=1.12.4-wp:3)
    at Function.each (jquery.js?ver=1.12.4-wp:2)
    at a.fn.init.each (jquery.js?ver=1.12.4-wp:2)

Also it made the calls to the Google servers, anyways.

martin-braun commented 4 years ago

2020-01-28 01 15 29

This is what I need and I implemented by my own. I would love to see my pull request tested, confirmed and implemented on the next version. See #18 for a detailed description of my changes.

Thanks.