Opened 13 months ago
#20459 new enhancement
Super admin should be able to bypass banned/limited domains when creating users
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Network Admin | Version: | |
| Severity: | minor | Keywords: | has-patch |
| Cc: |
Description
The function wpmu_validate_user_signup() is run whenever a new user is created, either through self-registration (wp-signup.php) or through manual user creation by an admin. wpmu_validate_user_signup() does two different kinds of validation:
(1) validation that is more or less technically required by WP, like spaces in usernames, email/login uniqueness, etc.
(2) checks against some admin-set membership restrictions, namely, email domain whitelist (limited_email_domains) and blacklist (is_email_address_unsafe() and banned_email_domains).
The second kind of validation is problematic in the following use case: An MS install might restrict open membership based on email domains, but the admin might occasionally want to make exceptions to the rule and manually create an account. Currently, there are two ways to bypass the built-in checks: to temporarily remove the domain restrictions at Network Admin > Settings, or to filter 'wpmu_validate_user_signup' and remove the error messages.
Having to manually change settings for this purpose is pretty hackish. The filter method works, but my experience (from consulting with a fairly large number of MS network admins) is that this is a pretty common use case, so it seems like it should be supported by default.
So I'm proposing that the domain checks be skipped when is_super_admin(). Patch attached.
