mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Users: Add 'illegal_user_logins' filter to allow certain usernames to be blacklisted.
Props danielbachhuber, chriscct7, crazycoolcam, SergeyBiryukov. Fixes #27317. git-svn-id: https://develop.svn.wordpress.org/trunk@35189 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -427,8 +427,14 @@ function wpmu_validate_user_signup($user_name, $user_email) {
|
||||
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
|
||||
add_site_option( 'illegal_names', $illegal_names );
|
||||
}
|
||||
if ( in_array( $user_name, $illegal_names ) )
|
||||
$errors->add('user_name', __( 'That username is not allowed.' ) );
|
||||
if ( in_array( $user_name, $illegal_names ) ) {
|
||||
$errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/user-functions.php */
|
||||
if ( in_array( $user_name, apply_filters( 'illegal_user_logins', array() ) ) ) {
|
||||
$errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
|
||||
}
|
||||
|
||||
if ( is_email_address_unsafe( $user_email ) )
|
||||
$errors->add('user_email', __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
|
||||
|
||||
Reference in New Issue
Block a user