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

WordPress Trac noreply at wordpress.org
Sun Jan 13 19:03:38 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 needs-codex  |
-------------------------------------------+------------------------------

Comment (by godhulii_1985):

 Replying to [comment:4 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_login`s 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.

 [[BR]]
 Okk. Ofcourse that note will make sense and additionally you can also
 mention get_user_by() function in the codex so that others can properly
 decide which function to use (for example: I have to use get_user_by() to
 solve my login issue)

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


More information about the wp-trac mailing list