Kristoff Posted September 9, 2014 Share Posted September 9, 2014 Hi guys, my client and I don't like or wish to use Captcha on the register form. Is it possible to add in a field to the registration form and check whether it's not empty and kill the registration? In cubecart.class.php on line 888 before: // Check email is valid if (!filter_var($_POST['user']['email'], FILTER_VALIDATE_EMAIL)) { $errors['email'] = true; $error_messages[] = $GLOBALS['language']->common['error_email_invalid']; } I've tried adding: if ($_POST['user']['middlename'] != "") { die(); } And then adding a hidden "middlename" field to the registration, but even if you complete middle name it lets you sign up. Anyone got any ideas why my code isn't working? Cheers Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 13, 2014 Share Posted September 13, 2014 In CC5213, line 888 is within the CubeCart->_checkout() function. This is not where you want to be if you are trying to catch bogus registrants. I assume you have edited the template file content.register.php by adding the hidden field middlename. (We will assume your tactic is valid.) In the file /classes/user.class.php, line 659 (CC5213), we test for an empty first_name, or an empty last_name. You can add your test after this for an existing middlename. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted September 13, 2014 Share Posted September 13, 2014 I would like to add this functionality to my store, but I need specific code for content.register.php and user.class.php. Thank you. Quote Link to comment Share on other sites More sharing options...
Kristoff Posted October 7, 2014 Author Share Posted October 7, 2014 In CC5213, line 888 is within the CubeCart->_checkout() function. This is not where you want to be if you are trying to catch bogus registrants. I assume you have edited the template file content.register.php by adding the hidden field middlename. (We will assume your tactic is valid.) In the file /classes/user.class.php, line 659 (CC5213), we test for an empty first_name, or an empty last_name. You can add your test after this for an existing middlename. Perfect, thank you. As the field is not something anyone will ever see I simply added: || !empty($_POST['email1']) To if (empty($_POST['first_name']) || empty($_POST['last_name'])) { And in my tests it seems to work. It does display "We need your name" error if the field is filled in, but that's fine as most people won't encounter it. Quote Link to comment Share on other sites More sharing options...
traylor23 Posted December 11, 2014 Share Posted December 11, 2014 I would love to have detailed instructions on how to do this also....started getting lots of spammy registrations and captcha has never worked for me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.