I can’t get this code to work with the Auth0 login widget but it does work with the wordpress default login. Does anyone know if there is something in the code that specifically doesn’t work with Auth0?
function restrict_email($value)
{
$email = $_REQUEST[‘bemail’];
if(!check_validity($email))
{
global $pmpro_msg, $pmpro_msgt;
$pmpro_msg = “Please enter a valid email address”;
$pmpro_msgt = “pmpro_error”;
$value = false;
}
return value;
}
add_filter(‘pmpro_registration_checks’,‘restrict_email’, 10, 1);
function getDomainFromEmail($email)
{
// Get the data after the @ sign
$domain = substr(strrchr($email, "@"), 1);
return $domain;
}
function check_validity($email)
{
$domain = getDomainFromEmail($email);
$valid_domains = array(“yahoo.com”, “.gmail.com", ".domain.uk”);
foreach($valid_domains as $valid_domain)
{
$components = explode(“.”, $valid_domain);
$domain_to_check = explode(“.”, $domain);
if($components[0] == “*” && sizeof($domain_to_check > 2))
{
if($components[1] == $domain_to_check[1] && $components[2] == $domain_to_check[2])
{
return true;
}
}
else
{
if(!(strpos($valid_domain, $domain) === false))
return true;
}
}
return false;
}