[wp-trac] [WordPress Trac] #21120: Optimize get_user_by()

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 19 20:55:10 UTC 2012


#21120: Optimize get_user_by()
------------------------------------+------------------------------
 Reporter:  kurtpayne               |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Performance             |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |
------------------------------------+------------------------------

Comment (by nacin):

 The main decision to be made here is whether wp_get_user() should return
 WP_User on failure, or false on failure.

 Currently, `new WP_User` and `wp_get_current_user()` will return a WP_User
 object. This object can then be checked with the `exists()` method.

 `get_userdata()` returns false if the user does not exist. The same goes
 for `get_user_by()`.

 scribu and I had a long discussion in IRC, with ryan chiming in as well.
 We outlined the pros and cons of each approach, how we see it currently
 implemented throughout WordPress, and how we envision similar getters to
 operate in the future. See
 https://irclogs.wordpress.org/chanlog.php?channel=wordpress-
 dev&day=2012-07-19&sort=asc#m424509, starts at 15:36, ends at 16:14.

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


More information about the wp-trac mailing list