Skip to:

Opened 12 years ago

Closed 7 years ago

#3807 closed enhancement (fixed)

groups_get_group() and BP_Groups_Group tuning

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Groups Keywords:
Cc: georgemamadashvili@…


Currently, when you load a group object, you also get things like group admins and mods, which adds a query. When all you need is, for example, the group name or the group avatar, you don't need this info. There should be a way to call up the group without getting this extra crap.

Change History (5)

#1 @Mamaduka
9 years ago

  • Cc georgemamadashvili@… added

#2 @tw2113
8 years ago

The Admin/Mods query is all part of the "generic" populate_extras argument, which is your basic true/false boolean value.

We would need to separate out and/or add extra params to $group_args to indicate whether or not to fetch these values, and act accordingly inside of BP_Groups_Group class.

Perhaps add both a param and/or a filter to exclude, and leave included by default to avoid backcompat issues.

#3 @boonebgorges
8 years ago

  • Keywords needs-patch added

Yes, a parameter to exclude just these options would be a start.

A more complete solution, IMO, would be to do the following:

  1. Ensure that the admin/mods query is properly cached.
  2. Lazy-load the admin/mods data. That is: make the properties protected, limiting access to __get(); and in __get(), fetch them only if they're needed. In the case of a groups loop, I'd say that they should all be pre-fetched into the cache no matter what (unless we want some sort of more sophisticated lazyload like WP does: But the more simple lazy-load would be quite effective when calling groups_get_group() outside of a loop.

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.

7 years ago

#5 @dcavins
7 years ago

  • Keywords needs-patch removed
  • Milestone changed from Future Release to 2.7
  • Resolution set to fixed
  • Status changed from new to closed

This ticket has been addressed in commits that improved BP_Groups_Group, especially r11071, r11087, r11089.

Note: See TracTickets for help on using tickets.