Created
August 3, 2022 05:28
-
-
Save cryptexvinci/cc30c6ae3409c481f5ce59d0b531fdc7 to your computer and use it in GitHub Desktop.
Ultimate Member Registration - List "disallowed" domain extensions such as .ru and .in
This file contains 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
<?php | |
add_action( 'um_submit_form_errors_hook__registration', 'um_custom_validate_username', 99 ); | |
function um_custom_validate_username( $args ) { | |
static $domain = '.in, .ru'; | |
if ( isset( $args['user_email'] ) ) { | |
if ( str_ends_with( $args['user_email'], '.in' ) || str_ends_with( $args['user_email'], '.ru' )) { | |
$message = sprintf( __( 'Cant use email domain %1$s for registration', 'ultimate-member' ), $domain ); | |
UM()->form()->add_error( 'user_email', $message ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment