[buddypress-trac] [BuddyPress] #3799: Grab and cache groupmeta when viewinga group page

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Dec 6 01:38:55 UTC 2011


#3799: Grab and cache groupmeta when viewinga group page
--------------------------+--------------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  1.6
Component:  Groups        |    Version:
 Severity:  major         |   Keywords:  dev-feedback
--------------------------+--------------------------
 Lots of plugins use groupmeta. If you use 5 different pieces of groupmeta
 in a group, it adds 5 queries to each page load. We should be a bit more
 generous about this in BP core.

 I propose that we do two things:
 - Refactor BP_Groups_Group::populate(). Remove the join against groupmeta
 in the initial query. Instead, do a single query for all groupmeta
 associated with that group. Then, we can stash the results in the
 $bp->groups->current_group object (kinda like WP does with the
 current_user object), or in the WP cache (like WP does with postmeta), or
 both.
 - Add a sweep of groupmeta to BP_Groups_Group::get(), so that the
 groupmeta for all the returned groups is either put into the WP cache or
 passed back with the resulting object. Because this could potentially be a
 large amount of data (especially if people are calling up large number of
 groups in utility functions), we should probably have a way to disable
 this with an optional parameter.

 We can look to WP's nice update_meta_cache() for guidance on how to do
 this. We can probably do the same thing for both of my suggestions.

 I'm happy to whip up a patch, but would be happy to get some feedback
 first. This is pretty painless, so could pretty easily go into BP 1.6 if I
 get a patch up in the next week or so. Otherwise it's puntable.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3799>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list