Need to Restrict Registering Email Domains
-
Hi, i need to restrict the registration to specific emails on my site, before installing this plugin was using the woocommerce hook ‘woocommerce_register_post’ to restrict the domains. can you please let me know which function to target in this plugin to restrict the email registrations to specific domains?
add_action(‘woocommerce_register_post’, ‘is_valid_email_domain’,10,3 );
function is_valid_email_domain($login, $email, $errors ){
$valid_email_domains = array(“gmail.com”,”yahoo.com”);// whitelist email domain lists
$valid = false;
foreach( $valid_email_domains as $d ){
$d_length = strlen( $d );
$current_email_domain = strtolower( substr( $email, -($d_length), $d_length));
if( $current_email_domain == strtolower($d) ){
$valid = true;
break;
}`
- The topic ‘Need to Restrict Registering Email Domains’ is closed to new replies.