-
-
Save cartpauj/5a15ec794b301448477138ec8bb71bf9 to your computer and use it in GitHub Desktop.
<?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'); |
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
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.
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?
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.
@pixelloop MemberPress recommends the Simple Turnstile plugin https://memberpress.com/docs/how-to-prevent-card-testing-and-fraudulent-sign-ups/
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.
Works great! As Google continues to work on Invisible ReCaptcha, I'll use this as it develops.