Skip Navigation

CRED 1.9.2.1 + Types 2.2.17-18: showstopper when using cred forms with recaptcha

Resolved

Reported for: Toolset Forms 1.9.2.1

Resolved in: Toolset CRED 1.9.3

Topic Tags: Toolset Forms

Symptoms

With CRED 1.9.2/1.9.2.1 and Types 2.2.17/2.2.18 installed, CRED Forms do not display the reCaptcha on the front-end, hence when an user submits the form, this error is produced:

Missing Captcha

Workaround

This issue will be fixed in the next release of Toolset CRED.

Currently you can use the ReCaptcha only by adding the following into your theme functions.php:

add_action('wp_head', 'cred_192_recaptcha_patch');
function cred_192_recaptcha_patch() {
    ?>
    <script>
        var onLoadRecaptcha = function () {
            //Init of all recaptcha
            jQuery.each(jQuery('.g-recaptcha'), function (i, recaptcha_selector) {
                var $current_form = jQuery(recaptcha_selector).closest('form');
                if (typeof grecaptcha !== 'undefined') {
                    var _sitekey = jQuery($current_form).find('div.g-recaptcha').data('sitekey');
                    this.recaptchaId = (typeof _sitekey !== 'undefined') ? grecaptcha.render(jQuery('.g-recaptcha')[0], {sitekey: _sitekey}) : -1;
                }
            });
        };
    </script>
    <?php
}

4 thought on CRED 1.9.2.1 + Types 2.2.17-18: showstopper when using cred forms with recaptcha

Comments are closed