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:
@@ -142,6 +142,12 @@ function edit_user( $user_id = 0 ) {
|
||||
if ( !$update && username_exists( $user->user_login ) )
|
||||
$errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ));
|
||||
|
||||
/** This filter is documented in wp-includes/user-functions.php */
|
||||
$usernames = apply_filters( 'illegal_user_logins', array() );
|
||||
if ( in_array( $user->user_login, $usernames ) ) {
|
||||
$errors->add( 'illegal_user_login', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
|
||||
}
|
||||
|
||||
/* checking email address */
|
||||
if ( empty( $user->user_email ) ) {
|
||||
$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an email address.' ), array( 'form-field' => 'email' ) );
|
||||
|
||||
Reference in New Issue
Block a user