Make WordPress Core


Ignore:
Timestamp:
10/15/2015 05:42:05 AM (11 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-includes/user-functions.php

    r35170 r35189  
    13161316        }
    13171317
     1318        /**
     1319         * Filter the list of blacklisted usernames.
     1320         *
     1321         * @since 4.4.0
     1322         *
     1323         * @param array $usernames Array of blacklisted usernames.
     1324         */
     1325        if ( in_array( $user_login, apply_filters( 'illegal_user_logins', array() ) ) ) {
     1326                return new WP_Error( 'illegal_user_login', __( 'Sorry, that username is not allowed.' ) );
     1327        }       
     1328
    13181329        /*
    13191330         * If a nicename is provided, remove unsafe user characters before using it.
Note: See TracChangeset for help on using the changeset viewer.