Skip to content

Instantly share code, notes, and snippets.

@cartpauj
Created April 4, 2017 16:19
Show Gist options
  • Save cartpauj/5a15ec794b301448477138ec8bb71bf9 to your computer and use it in GitHub Desktop.
Save cartpauj/5a15ec794b301448477138ec8bb71bf9 to your computer and use it in GitHub Desktop.
MemberPress + Invisible Recaptcha plugin integration (untested)
<?php
//Integrates MemberPress with https://wordpress.org/plugins/invisible-recaptcha/
//This is untested code ATM
function add_invisible_recaptcha_mepr_signup($membership_ID) {
?>
<div class="mp-form-row mepr_invisible_recaptcha">
<?php do_action('google_invre_render_widget_action'); ?>
</div>
<?php
}
add_filter('mepr-checkout-before-submit', 'add_invisible_recaptcha_mepr_signup');
function validate_invisible_recaptcha_mepr_signup($errors) {
$is_valid = apply_filters('google_invre_is_valid_request_filter', true);
if(!$is_valid) {
$errors[] = "Failed Captcha";
}
return $errors;
}
add_filter('mepr-validate-signup', 'validate_invisible_recaptcha_mepr_signup');
@surfer747
Copy link

Works great! As Google continues to work on Invisible ReCaptcha, I'll use this as it develops.

@Duttch
Copy link

Duttch commented Aug 21, 2018

Just came across your work, very nice. I was interested in how to apply it / where to put the php code and how to call it from memberpress? Thanks

@bbalazs777
Copy link

Works great, thanks! Can you add the Login and Forgot Password forms too? That would be awesome.

@Dutcch if you are using a child theme, just add this code to the end of it's functions.php . If you have activated Invisible Recaptcha in your WP you don't have to do anything else.

@hauge75
Copy link

hauge75 commented Feb 21, 2020

To implement the Invisible Recaptcha on the login form you could probably add it to the mepr-login-form-before-submit and mepr-validate-login hooks also?

@pixelloop
Copy link

I see the base plugin hasn't been updated for 4 years. It's crazy that Memberpress have never added a Google ReCaptcha add-on or setting.

I may be forced to try this and use an abandoned plugin. I'll report back on how it went and if it's still working.

@cartpauj
Copy link
Author

cartpauj commented Jul 2, 2024

@pixelloop
Copy link

@cartpauj

Ah, thanks, that's good to know. I missed that.

I may give that a try instead of ReCaptcha v3 and see if it solves my client's issue.

I appreciate you getting back to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment