ClipBucket MOD – How to Block email domains.

This code was tested with ClupBucket 2.0.6. This will allow you to block specific emails domains. It is partivularly useful to block all email providers used to spam (like mailinator.com or temporaryinbox.com).

1st – Open your database and add a record to your config datatable (default is cb_config) with the value “disallowed_email_providers”.
2nd – Open clipbucket Control Panel and add a new phrase with code “usr_email_blacklisted_err” and value “Invalid email”.

3rd – open the main.html from your template.

Search for :

<tr>
<td valign="top">Disallowed usernames</td>
<td valign="top"><label>
<textarea name="disallowed_usernames" id="disallowed_usernames" cols="45" rows="5">{$row.disallowed_usernames}</textarea>
<br />
separate by commas
</label></td>
</tr>

and add below:

<tr>
<td valign="top">Disallowed email providers</td>
<td valign="top"><label>
<textarea name="disallowed_email_providers" id="disallowed_email_providers" cols="45" rows="5">{$row.disallowed_email_providers}</textarea>
<br />
separate by commas
</label></td>
</tr>

4th – Open admin_area/main.php and find (around line 56):

'disallowed_usernames',

and add below :

'disallowed_email_providers',

5th – Open includes/classes/user.class.php and add this function right above the signup_user function (around line 3160) :

/**
* Function to validate email provider
*/
function blacklisted($email){
global $Cbucket;
 
$providers = explode(",", $Cbucket->configs['disallowed_email_providers']);
 
foreach($providers as $provider){
if(eregi(trim($provider) . "$", $email))
return true;
}
return false;
}

6th – Finally enter function signup_user, locate this :

//checking terms and policy agreement
if($array['agree']!='yes' && !has_access('admin_access',true))
e(lang('usr_ament_err'));

add below :

//Check if email provider is blacklisted
if($this->blacklisted($array['email']))
e(lang('usr_email_blacklisted_err'));

You should now be able to block email providers 🙂

Leave a Reply

Your email address will not be published.