[buddypress-trac] [BuddyPress Trac] #7382: groups_promote_member() shouldn't attempt to fetch `BP_Core_User` object

buddypress-trac noreply at wordpress.org
Thu Dec 15 03:11:43 UTC 2016


#7382: groups_promote_member() shouldn't attempt to fetch `BP_Core_User` object
-------------------------+------------------
 Reporter:  r-a-y        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  2.8
Component:  Groups       |     Version:  1.0
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------

Comment (by boonebgorges):

 Replying to [comment:3 DJPaul]:
 > How does 7382.diff prevent the extra queries being made? I can't see it.

 1. The `user` property is not populated by default
 2. If some piece of code requests something from `$member_object->user`,
 `__get()` is invoked because `user` is protected
 3. `__get()` fetches the user object just in time

 In my tests, this cuts out 25(!) queries from group member promotion.

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


More information about the buddypress-trac mailing list