271536b0 by Jeff Balicki

ssss

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent d285fbac
......@@ -150,14 +150,12 @@ add_action( 'um_submit_form_errors_hook__registration', 'um_validate_email_domai
function is_valid_email_domain($login, $email, $errors ){
$valid_email_domains = array("gotenzing.com","ekccu.com","stellervista.com");// allowed domains
$allowed_email_domains = array("gotenzing.com","ekccu.com","stellervista.com");// allowed domains
$valid = false; // sets default validation to 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) ){
if ( isset( $email ) && is_email( $email ) ) {
$email_domain = array_pop( explode( '@', trim( $email) ) );
if ( in_array( $email_domain, $allowed_email_domains ) ) {
$valid = true;
break;
}
}
// Return error message for invalid domains
......@@ -170,20 +168,3 @@ function is_valid_email_domain($login, $email, $errors ){
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
......