[buddypress-trac] [BuddyPress Trac] #5445: Improve consistency of bp_core_get_user_* use

buddypress-trac noreply at wordpress.org
Mon Mar 3 20:17:20 UTC 2014


#5445: Improve consistency of bp_core_get_user_* use
--------------------------+------------------
 Reporter:  boonebgorges  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  2.0
Component:  Core          |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------

Comment (by boonebgorges):

 In [changeset:"8024"]:
 {{{
 #!CommitTicketReference repository="" revision="8024"
 Cache userdata after running WP_User_Query in BP_User_Query

 WP_User_Query does not cache data that is stored in wp_users in a bulk
 fashion.
 BP, on the other hand, does cache this data, as 'bp_core_userdata_' .
 $user_id.
 This cached userdata is then referenced in many places throughout BP,
 including
 the building of user_domains and userlinks. Thus, it can save up to 20
 queries
 per page (assuming per_page=20) during query loops.

 A corresponding change has been made to the 'fields' parameter passed to
 WP_User_Query from BP_User_Query. Because BP caches entire wp_users rows
 (see
 BP_Core_User::get_core_userdata()), we must ensure that BP_User_Query is
 also
 fetching entire rows. We opt not to use WP_User_Query's 'fields=all'
 parameter,
 because it triggers the casting of WP_User objects, which in turn requires
 expensive capability lookups.

 See #5445
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5445#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list