Skip to content

Instantly share code, notes, and snippets.

@ultimatemember
Last active October 25, 2018 01:50
Show Gist options
  • Save ultimatemember/5f093ac300baa1d2a5f1 to your computer and use it in GitHub Desktop.
Save ultimatemember/5f093ac300baa1d2a5f1 to your computer and use it in GitHub Desktop.
Example: block any registration that does not use @gmail as mail provider
/*
The following code will require @gmail.com as domain
for user registrations.
You can change @gmail.com to any provider you want.
The code below requires a user email to be collected during registration
*/
add_action('um_before_new_user_register', 'require_google_email_for_signup');
function require_google_email_for_signup( $args ) {
extract($args);
if ( !strstr( $user_email, '@gmail.com' ) )
exit( wp_redirect( add_query_arg('err', 'you_must_have_googlemail') ) );
}
@camilolunacom
Copy link

‘um_before_new_user_register’ has been depreciated, is it possible to ha ave an update version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment