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-includes/ms-functions.php

    r35170 r35189  
    428428        add_site_option( 'illegal_names', $illegal_names );
    429429    }
    430     if ( in_array( $user_name, $illegal_names ) )
    431         $errors->add('user_name',  __( 'That username is not allowed.' ) );
     430    if ( in_array( $user_name, $illegal_names ) ) {
     431        $errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
     432    }
     433
     434    /** This filter is documented in wp-includes/user-functions.php */
     435    if ( in_array( $user_name, apply_filters( 'illegal_user_logins', array() ) ) ) {
     436        $errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
     437    }
    432438
    433439    if ( is_email_address_unsafe( $user_email ) )
Note: See TracChangeset for help on using the changeset viewer.