Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress Registration Email Validation Re: WordPress Registration Email Validation

#81889
ddliu
Member

I don’t think it’s in the theme, you may change it here:
file wp-login.php, find function “register_new_user”, find code:


// Check the e-mail address
if ( $user_email == '' ) {
$errors->add( 'empty_email', __( 'ERROR: Please type your e-mail address.' ) );
} elseif ( ! is_email( $user_email ) ) {
$errors->add( 'invalid_email', __( 'ERROR: The email address isn’t correct.' ) );
$user_email = '';
} elseif ( email_exists( $user_email ) ) {
$errors->add( 'email_exists', __( 'ERROR: This email is already registered, please choose another one.' ) );
}

add following code at the end of the if…else… scope:


elseif (!preg_match('#[@.]ac.uk$#i', $user_email){
$errors->add( 'invalid_email', __( 'ERROR: Only "ac.uk" email address allowed.' ) );
$user_email = '';
}

Maybe there is a way to change it in the theme? I have no idea, don’t know that much.