If you are suffering from spammers repeatedly joining up from the same email domains, this mod will help stop this.

It's a quick and dirty mod that compares the email address submitted via the join form against a list of banned domains. If the submitted email matches an entry in the list, the standard 'please enter correct email' message will be displayed, preventing the join form from being submitted.

Create a file called validate_email.php and add the following info. Save it in your webroot. Be sure to add additional domains as required.

$is_valid = false;
 
//banned email domains
$banned_domains = array(
'163.com',
'yahoo.cn',
'126.com');

$email_domain = explode('@',$arg0);

foreach ($banned_domains as $domain) {
if ($email_domain[1] == $domain) {
$is_valid = false;
break;
} else {
$is_valid = (bool) preg_match('/^([a-z0-9\+\_\-\.]+)@([a-z0-9\+\_\-\.]+)$/i', $arg0);
}
}
?>

Next go to the profile builder

in admin > builders > profile > email > advanced > check

change

return (bool) preg_match('/^([a-z0-9\+\_\-\.]+)@([a-z0-9\+\_\-\.]+)$/i', $arg0);

to

include ('validate_email.php');

return $is_valid;

Save the change.

Now test the mod out by trying to join up using one of the banned email domains.

Job done :)

/DM