• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 20.10.20, 15:58
  • Opened by: Trisketos
  • Closed by: Anonymous Submitter
  • Closed on:
  • Reason: Not a bug

Ticket #19502 - reCaptcha not loading in contact form because of pkheaderitems

Hi

As in the title, the reCaptcha is not loading in contact page, and after debuging a bit i found that is loading but only in the headeritems register icon.

The fast workarround is to add an extra render in the script.js file, like this, but would be nice to make a function to detect and load a reCaptcha on all forms.

if (typeof pkcaptcha !== 'undefined')
{
    var pkbox = 'captcha-box';

    var onloadCallback = function()
    {
        grecaptcha.render('captcha-box-createaccount', {
            'sitekey' : pkcaptcha.key
		});

		grecaptcha.render('captcha-box-contactform', {
            'sitekey' : pkcaptcha.key
        });
    };

    $(document).ready(function()
    {
        if (parseInt(pkcaptcha.contactform) === 1)
        {
            var captchaform = '.contactform-captcha .form-fields';
            $(captchaform).append('<div id="'+pkbox+'-contactform"></div>');
        }

        if (parseInt(pkcaptcha.createaccount_dd) === 1)
        {
            var captchaform = '.pkheader-captcha';
            $(captchaform).append('<div id="'+pkbox+'-createaccount"></div>');
        }
    });

} else {
    console.warn('Pkcaptcha module is installed but not configured');
}

Comments

Fred 20 Oct 2020, 18:20

Hi, Miquel.
Please fill out all necessary fields in your profile https://support.promokit.eu/index.php?do=myprofile to access to your back office and FTP I’ll try to make a fix