731eccd9 by Jeff Balicki

email domain

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 4c19c8b0
......@@ -167,4 +167,23 @@ function is_valid_email_domain($login, $email, $errors ){
}
}
add_action('register_post', 'is_valid_email_domain',10,3 );
\ No newline at end of file
add_action( 'um_submit_form_errors_hook__registration', 'um_register_email_provider_restrict', 99 );
function um_register_email_provider_restrict( $args ) {
// List the email providers you want to allow
$allowed_domains = array("gotenzing.com","ekccu.com","stellervista.com");
// For each domain provider check if the domain provider is allowed for registration.
foreach( $allowed_domains as $domain ) {
if ( isset( $args['user_email'] ) ) {
if ( !strstr( $args['user_email'], $domain ) ) {
$message = sprintf( __( 'Only use the email domain %1$s, %2$s for registration', 'ultimate-member' ), $allowed_domains[0], $allowed_domains[1] );
UM()->form()->add_error( 'user_email', $message );
}
}
}
}
\ No newline at end of file
......