[wp-trac] [WordPress Trac] #9020: Add standard ID value (for user id's) to output of get_users_of_blog() to be compatible

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 2 19:53:38 GMT 2009


#9020: Add standard ID value (for user id's) to output of get_users_of_blog() to
be compatible
--------------------------+-------------------------------------------------
 Reporter:  jeremyclarke  |       Owner:  jeremyclarke
     Type:  defect (bug)  |      Status:  new         
 Priority:  normal        |   Milestone:  2.8         
Component:  General       |     Version:  2.7         
 Severity:  normal        |    Keywords:  has-patch   
--------------------------+-------------------------------------------------
 Currently the get_users_of_blog() function (which fetches all users of a
 given blog for WPMU but is also the only API way to get all the users at
 once on a normal wp install) returns an array of objects containing the
 most generally relevant information about users, but not the full contents
 of their row in the users and user_meta tables (it gets id, login, display
 name, email and permissions).

 Unfortunately and a bit insanely, when fetching the user id it gets the
 user_id field from the user meta table rather than the plain ID from the
 users table. Pretty much everywhere in wp the ID label is used for
 checking IDs, and so the output of get_users_of_blog is pretty much
 useless except if you are writing custom functions (probably what it was
 designed for).

 This patch does just one little thing, in the SQL inside
 get_users_of_blog() it fetches both the user_id from user meta table AND
 the ID from the users table. This way the output can be used with other
 user API functions when appropriate and it is backwards compatible with
 whatever people were already doign with the user_id field.

 Admittedly it returns redundant information but IMHO its so worth it
 because it makes the function much more usefull and less confusing/insane.

 [NOTE: This function should be replaced with a more general get_users()
 function that accepts get_posts/get_terms style arguments like blog=1 or
 role=admin. But this will make it more useful in the meantime]

 I can't think of a reason not to commit this. Thanks,

-- 
Ticket URL: <http://trac.wordpress.org/ticket/9020>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list