Skip to content

Instantly share code, notes, and snippets.

@NateJacobs
Created October 2, 2011 10:31
Show Gist options
  • Save NateJacobs/1257325 to your computer and use it in GitHub Desktop.
Save NateJacobs/1257325 to your computer and use it in GitHub Desktop.
Check for city email during registration
<?php
/**
* Check for City Email
*
* If a user tries to register with a city email address an error is returned.
*
* @author Nate Jacobs
* @link http://gist.github.com/1257325
*/
add_action( 'registration_errors', 'check_user_email',10, 3 );
function check_user_email( $errors, $login, $email )
{
list( $addy, $domain ) = explode( "@", $email );
if ( $domain == 'chandleraz.gov' )
{
$errors->add('empty_realname', __( '<strong>City Email Alert: </strong><br>No @chandleraz.gov email addresses allowed.' ) );
}
return $errors;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment