Customized IsValidEmailAddress in FEU
Posted: Fri Dec 01, 2006 2:30 pm
Hi,
I would like to have a customized IsValidEmailAddress() in FrontEndUsers (FEU). I use the SelfRegistion module, but only users with e-mail addresses of a fixed set of domains are allowed to register themselves.
What is the cleanest approach to achieve this? Now I just hacked FrontEndUsers.api.php:
function IsValidEmailAddress( $email, $smtpvalidate = false, $uid = -1 )
{
...
$AllowedDomains = array('@example.com', 'me@somewhere.eu');
$regex = '('.join('|', $AllowedDomains).')$';
if ( !eregi($regex, $email) )
{
$result[0] = false;
$result[1] = "Invalid domain";
return $result;
}
Mark
I would like to have a customized IsValidEmailAddress() in FrontEndUsers (FEU). I use the SelfRegistion module, but only users with e-mail addresses of a fixed set of domains are allowed to register themselves.
What is the cleanest approach to achieve this? Now I just hacked FrontEndUsers.api.php:
function IsValidEmailAddress( $email, $smtpvalidate = false, $uid = -1 )
{
...
$AllowedDomains = array('@example.com', 'me@somewhere.eu');
$regex = '('.join('|', $AllowedDomains).')$';
if ( !eregi($regex, $email) )
{
$result[0] = false;
$result[1] = "Invalid domain";
return $result;
}
Mark