hCaptcha support - Forum | JoomShaper
Solved SP Page Builder

hCaptcha support

Asked by Jeroen 2 years ago Last activity 2 years ago

Hi,

I'm looking for hCaptcha (https://www.hcaptcha.com/) support in the forms addon in SP Page Builder Pro 5.2.6.
How can this be done?

Best regards,
Jeroen

Accepted answer

Marked as the solution
Jeroen Asked this

I hope hCaptcha will be added to SPPB5 or that the mentioned data2site hCaptcha plugin is allowed to work with SPPB5.

Best regards, Jeroen

7 more replies

Paul Frankowski Senior Staff

Hi Jeroen,

  1. Right now we don't support it.
  2. Only by Addon code customization (site.php)

OR

Install Form extension that support it.

Yes, I added to wish list.

Jeroen Asked this

Hi Paul,

I have installed the plugin https://data2site.com/extensions/hcaptcha in Joomla 4.4.2.
Activated the plugin. In the "Global configuration" of Joomla at "Default Captcha" I can now select "CAPTCHA - hCaptcha".
In SP Page builder Pro at the "Form Builder" plugin I can only select "Default" which is the standard captcha of SP Page Builder, "Google reCaptcha" and "Google Invisible reCaptcha".
Why can't I select hCaptcha from Data2site?

Best regards, Jeroen

Paul Frankowski Senior Staff

Becuase it wasn't included in addon sourcecode.

bouey
2 years ago · edited

Hi,

It's seem not too complicated to add , i have done it on my site (for the form_builder addon)
tested on 3.8.10 but should work exacly the same in 5.X

  1. install and publish the plugin from https://data2site.com/extensions/hcaptcha
    set it as default captcha as hcaptcha in Joomla > Global Configuration Site

  2. make an override of the form_builder in your template templates/{your_template}/sppagebuilder/addons/form_builder

  3. copy the original file site.php and admin.php

  4. modify admin.php to add the choise of hcaptcha

  5. modify site.php to manage the hcaptcha

admin.php line 436
add the line with //sbou and make an override in your language to have the right name

                        'values' => array(
                            'default'   => Text::_('COM_SPPAGEBUILDER_GLOBAL_CAPTCHA_TYPE_DEFAULT'),
                            'gcaptcha'  => Text::_('COM_SPPAGEBUILDER_GLOBAL_CAPTCHA_TYPE_GCHAPTCHA'),
                            'igcaptcha' => Text::_('COM_SPPAGEBUILDER_GLOBAL_CAPTCHA_TYPE_INVISIBLE_GCHAPTCHA'),
                            'hcaptcha' => JText::_('COM_SPPAGEBUILDER_GLOBAL_CAPTCHA_TYPE_HCAPTCHA'),//sbou
                        ),

site.php
2 changes
line 312 add the line between //sbou .... //end sbou

        elseif ($enable_captcha && $captcha_type == 'igcaptcha')
        {
            PluginHelper::importPlugin('captcha', 'recaptcha_invisible');
            Factory::getApplication()->triggerEvent('onInit', ['invisible_recaptcha_' . $this->addon->id]);
            $recaptcha = Factory::getApplication()->triggerEvent('onDisplay', array(null, 'invisible_recaptcha_' . $this->addon->id, 'sppb-dynamic-recaptcha'));

            $output .= (isset($recaptcha[0])) ? $recaptcha[0] : '<p class="sppb-text-danger">' . Text::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_INVISIBLE_CAPTCHA_NOT_INSTALLED') . '</p>';
        }
        //sbou
        elseif ($enable_captcha && $captcha_type == 'hcaptcha')
        {
            PluginHelper::importPlugin('captcha', 'hcaptcha');
            Factory::getApplication()->triggerEvent('onInit');
            $recaptcha = Factory::getApplication()->triggerEvent('onDisplay', array(null, 'hcaptcha_' . $this->addon->id, 'sppb-dynamic-hcaptcha'));

            $output .= (isset($recaptcha[0])) ? $recaptcha[0] : '<p class="sppb-text-danger">' . Text::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_HCAPTCHA_NOT_INSTALLED') . '</p>';
        }
        //end sbou
        $output .= '<input type="hidden" name="captcha_type" value="' . $captcha_type . '">';

ligne 566

if ($captcha_type == 'igcaptcha')
                    {
                        PluginHelper::importPlugin('captcha', 'recaptcha_invisible');
                        $output['gcaptchaId']   = 'invisible_recaptcha_' . $addon_id;
                        $output['gcaptchaType'] = 'invisible';
                    }
                    elseif ($captcha_type == 'hcaptcha')//sbou
                    {
                        PluginHelper::importPlugin('captcha', 'hcaptcha');
                        $output['gcaptchaId']   = 'hcaptcha_' . $addon_id;
                        $output['gcaptchaType'] = 'dynamic';
                    }
                    else
                    {
                        PluginHelper::importPlugin('captcha', 'recaptcha');
                        $output['gcaptchaId']   = 'dynamic_recaptcha_' . $addon_id;
                        $output['gcaptchaType'] = 'dynamic';
                    }

Stéphane
faboba.com

Jeroen Asked this

Thanks for your information Bouey.
I just prefer to use overrides as little as possible.
So I hope Joomshaper will add hCaptcha to SPPB.

Paul Frankowski Senior Staff

Thanks, Yes, I added to wish-list.

@Jeroen - you can just override only that addon inside template folder, and use it as long you need.

bouey

Yes it was write on my thread but Jeroen prefer not to make override

make an override of the form_builder in your template templates/{your_template}/sppagebuilder/addons/form_builder

tested since a week and work fine

Stéphane

Log in to reply.