This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
reCaptcha: Is it possible to whitelist IP addresses?
Started 15 years ago by jww | 3 posts |
-
I have a question about implementing reCaptcha in MachForm.
Many of our form submissions will be from users who are within the campus network. However, our forms still need to be available to everyone.
Here's my question: Is it possible to whitelist IP addresses so that users on the listed networks can skip the reCaptcha? We never get hit with form spam from on-campus IP addresses, so the reCaptcha only needs appear on forms when (potential) spammers connect from external IPs.
Thanks for your help!
jwwPosted 15 years ago # -
Hi jww,
You need to edit "view-functions.php" and "post-functions.php" file for this. Try to follow these steps :
1. Edit "view-functions.php" file and go to around line 1445, you'll see this code :
function display_captcha($element){
put these code exactly bellow that line
if ($_SERVER['REMOTE_ADDR'] == 'localhost' || $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ) { return; }
2. Edit "post-functions.php" file and go to line 894, you'll see this :
if(!empty($form_captcha) && empty($error_elements)) {
replace that code with this one
if ($_SERVER['REMOTE_ADDR'] == 'localhost' || $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ) { $captcha_pass = false; } else { $captcha_pass = true; } if(!empty($form_captcha) && empty($error_elements) && $captcha_pass){
Those code will remove captcha function when I access the form with 'localhost' ip address, you need to change that IP address with your campus IP address
MachForm Support
Posted 15 years ago # -
Redityo,
Excellent -- thank you very much!
jww
Posted 15 years ago #
Reply
You must log in to post.