You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IS this code correct? i found this code from a website but not related to osclass...''Hi, how can I allow only gmail, ymail, and hotmail emails only when user registration on osclass? to prevent spam? is there any code?
functionis_valid_email_domain($login, $email, $errors)
{
$valid_email_domains = array(
"gmail.com",
"yahoo.com"
);
// whitelist email domain lists$valid = false;
foreach ($valid_email_domainsas$d)
{
$d_length = strlen($d);
$current_email_domain = strtolower(substr($email, -($d_length) , $d_length));
if ($current_email_domain == strtolower($d))
{
$valid = true;
break;
}
}
// if invalid, return error messageif ($valid === false)
{
$errors->add('domain_whitelist_error', __('<strong>ERROR</strong>: you can only register using @gmail.com or @yahoo.com emails'));
}
}
add_action('register_post', 'is_valid_email_domain', 10, 3);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
IS this code correct? i found this code from a website but not related to osclass...''Hi, how can I allow only gmail, ymail, and hotmail emails only when user registration on osclass? to prevent spam? is there any code?
Beta Was this translation helpful? Give feedback.
All reactions