PDA

View Full Version : Reverse ban emails?


JMikeS
09-06-2006, 06:20 PM
edit: nevermind, solution here: https://vborg.vbsupport.ru/showthread.php?t=69125&highlight=email+ban

<hits self for not searching>

I need to only allow emails from a certain domain. I work at a university and we want to restrict the community.

I've tried to reverse the return values (0, 1) in functions_user.php but it didn't work.



Any ideas?

Mythotical
09-06-2006, 11:39 PM
Use this:
Find:
// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
global $vbulletin;

if ($vbulletin->options['enablebanning'] AND $vbulletin->banemail !== null)
{
$bannedemails = preg_split('/\s+/', $vbulletin->banemail, -1, PREG_SPLIT_NO_EMPTY);

foreach ($bannedemails AS $bannedemail)
{
if (is_valid_email($bannedemail))
{
$regex = '^' . preg_quote($bannedemail, '#') . '$';
}
else
{
$regex = preg_quote($bannedemail, '#') . ($vbulletin->options['aggressiveemailban'] ? '' : '$');
}

if (preg_match("#$regex#i", $email))
{
return 1;
}
}
}

return 0;
}

To:
// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
global $vbulletin;

if ($vbulletin->options['enablebanning'] AND $vbulletin->banemail !== null)
{
$bannedemails = preg_split('/\s+/', $vbulletin->banemail, -1, PREG_SPLIT_NO_EMPTY);

foreach ($bannedemails AS $bannedemail)
{
if (is_valid_email($bannedemail))
{
$regex = '^' . preg_quote($bannedemail, '#') . '$';
}
else
{
$regex = preg_quote($bannedemail, '#') . ($vbulletin->options['aggressiveemailban'] ? '' : '$');
}

if (preg_match("#$regex#i", $email))
{
return 0;
}
}
}

return 1;
}

I have tested this and it works just fine.

Tested on 3.5.x and 3.6.0