Make WordPress Core


Ignore:
Timestamp:
10/15/2015 05:42:05 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Users: Add 'illegal_user_logins' filter to allow certain usernames to be blacklisted.

Props danielbachhuber, chriscct7, crazycoolcam, SergeyBiryukov.
Fixes #27317.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/user.php

    r35170 r35189  
    142142    if ( !$update && username_exists( $user->user_login ) )
    143143        $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ));
     144
     145    /** This filter is documented in wp-includes/user-functions.php */
     146    $usernames = apply_filters( 'illegal_user_logins', array() );
     147    if ( in_array( $user->user_login, $usernames ) ) {
     148        $errors->add( 'illegal_user_login', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
     149    }
    144150
    145151    /* checking email address */
Note: See TracChangeset for help on using the changeset viewer.