Last active
May 26, 2016 14:25
-
-
Save stevenhoney/b42fb73dedffe503eb8a5c11b51ec2ed to your computer and use it in GitHub Desktop.
Only allow users with an email address at a specific domain to register
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function allow_single_email_domain( $user_login, $user_email, $errors ) { | |
if ( strpos( $user_email, '@youralloweddomain.com' ) != -1 ) { | |
return; | |
} else { | |
$errors->add( 'bad_email_domain', '<strong>ERROR</strong>: This email domain is not allowed.' ); | |
} | |
} | |
add_action( 'register_post', 'allow_single_email_domain', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment