[wp-trac] [WordPress Trac] #23190: get_user_id_from_string() is returning wrong data

WordPress Trac noreply at wordpress.org
Sun Jan 13 14:30:28 UTC 2013


#23190: get_user_id_from_string() is returning wrong data
-------------------------------+------------------------------
 Reporter:  godhulii_1985      |       Owner:
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Multisite          |     Version:  3.5
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------

Comment (by scribu):

 I tend to agree with alexvom2; if you know you're dealing with user
 logins, just use `get_user_by('login', 123456)`.

 > if there is no binding on wp_insert_user() with a numeric value (123456)
 as user-id then get_user_id_from_string() should also respect this choice
 and return 99 here instead of 123456

 I don't think that's a good idea, unless we plan to support numeric
 user_logins everywhere. For example, `WP_User::__construct()` has the same
 heuristic.

 We should just document that `get_user_id_from_string( $x )` will return
 $x, if $x is numeric.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23190#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list