reCAPTCHA v2

ExpressionEngine Addon


Version: 1.1.0
Author url: http://eecoding.com/
3rd Party (Commercial)


Table of contents

This addon replaces the built-in ExpressionEngine captcha to Google reCAPTCHA v2.

Supported forms

To use reCAPTCHA, you need to sign up on Google and receive API key pair for your site. The key pair consists of a site key and secret. For more details read below: https://developers.google.com/recaptcha/docs/start

AJAX contents support

You can generate reCAPTCHA for dynamic loaded forms,
Simply apply the function as shown below:

$("#my_dynamic_form").load('/my_dynamic_form', function(){ document.reCAPTCHAv2( $(this).find('.g-recaptcha') ); });

Now you have reCAPTCHAv2_init event (for jQuery only):

$(document).on('reCAPTCHAv2_init', function(){ // your code });

Installation for ExpressionEngine v1.7.x

!!! WARNING For the old EE version - only basic forms are supported

  1. Upload the ext.recaptchav2_ext.php file to system/extensions/
  2. Upload the lang.recaptchav2_ext.php file to system/language/english/
  3. Enable and configure the extension via Admin > Utilities > Extensions Manager
  4. Remove the hard-coded CAPTCHA input field from your member registration template (../themes/profile_themes/[theme_name]/profile_theme.html) and any comment submission form templates so that the CAPTCHA's conditional block looks like:
{if captcha} {captcha} {/if}

Installation for ExpressionEngine v2.x

  1. Upload the recaptchav2 folder to system/expressionengine/third_party
  2. Enable and configure the extension via Add-Ons > Extensions
  3. Remove the hard-coded CAPTCHA input field from your member registration template (../themes/profile_themes/[theme_name]/registration_form.html) and any comment submission form templates so that the CAPTCHA's conditional block looks like:
{if captcha} {captcha} {/if}

Installation for ExpressionEngine v3.x

  1. Upload the recaptchav2 folder to system/user/addons
  2. Enable and configure the extension via Developer > Add-On Manager
  3. Remove the hard-coded CAPTCHA input field from your member registration template (../themes/ee/member/[theme_name]/registration_form.html) and any comment submission form templates so that the CAPTCHA's conditional block looks like:
{if captcha} {captcha} {/if}

Installation for ExpressionEngine v4.x-v6.x

ExpressionEngine v3, v4, v5 and v6 add-ons is absolutely compatible (at now).

  1. Upload the EE3/recaptchav2 folder to system/user/addons
  2. Enable and configure the extension via Developer > Add-On Manager
  3. Remove the hard-coded CAPTCHA input field from your member registration template (../themes/ee/member/[theme_name]/registration_form.html) and any comment submission form templates so that the CAPTCHA's conditional block looks like:
{if captcha} {captcha} {/if}

Global variables

F.A.Q.

Can I use this with the MSM?
It should work as long as you use a Global key by ticking Enable this key on all domains (global key) when you create your reCAPTCHA key.

I keep getting "Unable to receive your comment at this time." when testing the comment submission form?
If you’re testing with the same comment text, EE is likely enforcing spam protection and/or throttling your post. Test with unique comments or adjust the settings at:

I specified in the auto append settings "Add before closing tag ", but the script is not added and I see the error "document.reCAPTCHAv2 is not a function" (or there are no errors at all)
Most likely you defined a closing tag in global variables, which caused an error. You can also try to add the main script manually using the global variable {recaptcha:script} and change auto append setting to "Do not add script (manual variant)"


Notes and Warnings

!!!Attention, in version 1.0.2, the logic of initialization of captcha has been changed (not for EE1)! Now the main script will be added at the user's choice:

Also, note that automatically the script will be inserted in all cases, except when the closing tags are defined in global variables. For example, if you select "Add before closing tag </head>" and you have a global variable {html_head} where you defined the closing tag "</head>" - then the script will not be added

!!! WARNING Add-on for EE version 1.x - support only basic forms (hooks)


Changelog

1.1.0 (2021/11/11)

1.0.5 (2019/02/05)

1.0.4 (2018/06/02)

1.0.3 (2018/05/28)

1.0.2 (2018/01/26)

1.0.1 (2016/09/14)

1.0