[buddypress-trac] [BuddyPress Trac] #7609: Add "IDs only" return format option for BP_Groups_Group::get().
buddypress-trac
noreply at wordpress.org
Mon Oct 16 15:40:34 UTC 2017
#7609: Add "IDs only" return format option for BP_Groups_Group::get().
-------------------------+-----------------------
Reporter: dcavins | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.0
Component: Groups | Version: 2.9.0
Severity: normal | Keywords: has-patch
-------------------------+-----------------------
In some cases, all I need back from `groups_get_groups()` is the IDs of
the groups. It's possible to fetch the objects and then `wp_list_pluck()`
out the IDs, but it's much more efficient to skip the group object
creation step and just return the found IDs.
In the attached patch, I've added a new parameter, `ids_only` that skips
creation of group objects. I also decided that if you wanted the IDs only,
you probably don't want to prefetch the group meta and group admins and
mods data. However, this is not required. The new parameter (whatever we
want to call it) can be independent of `update_meta_cache` and
`update_admin_cache` if that makes more sense in other use cases. Please
offer your feedback about this approach and whether it should be
independent or if it makes sense to assume that if you want the IDs only,
you don't want extraneous data/queries.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7609>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list