[wp-trac] [WordPress Trac] #27317: Update wp_insert_user function to return 'pre_user_login' filter WP_Errors

WordPress Trac noreply at wordpress.org
Wed Nov 11 22:42:35 UTC 2015


#27317: Update wp_insert_user function to return 'pre_user_login' filter WP_Errors
--------------------------------------+------------------------
 Reporter:  crazycoolcam              |       Owner:  chriscct7
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:  4.4
Component:  Users                     |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  commit 2nd-opinion close  |     Focuses:
--------------------------------------+------------------------
Changes (by juliobox):

 * keywords:  has-patch commit => commit 2nd-opinion close


Comment:

 Hello,

 i just tested it and i'm feeling confused ...
 Here's my simple code, the one you'll see on 100 websites at day 1 after
 4.4 release:
 {{{#!php
 <?php
 add_filter( 'illegal_user_logins', 'admin_is_an_illegal_user_login' );
 function admin_is_an_illegal_user_login() {
         return array( 'admin' );
 }
 }}}
 So now, i'm running a fresh 4.4-b3 (monosite) with this mu-plugin and i
 try to add a user named "admin", it works fine, great job i lmike that.
 But ... if i try to add a user named "Admin", it's ok(!) this is why i'm
 feeling confused, for me, "Admin", "admin", "aDmIn", "AdMiN" is the same
 forbidden user login, see what i mean?

 It's ok on multisite because we use strtolower() on that.

 So i would rather prefer that:
 {{{#!php
 <?php
 if ( in_array( strtolower( $user->user_login ), $usernames ) ) {
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27317#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list