[buddypress-trac] [BuddyPress Trac] #5099: Total groups wrong when fetching groups with meta query
buddypress-trac
noreply at wordpress.org
Fri Sep 9 15:00:15 UTC 2016
#5099: Total groups wrong when fetching groups with meta query
---------------------------+-----------------------------
Reporter: r-a-y | Owner: boonebgorges
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Future Release
Component: Groups | Version: 1.8
Severity: normal | Resolution: fixed
Keywords: needs-refresh |
---------------------------+-----------------------------
Changes (by boonebgorges):
* owner: => boonebgorges
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"11071"]:
{{{
#!CommitTicketReference repository="" revision="11071"
Groups: Overhaul `BP_Groups_Group::get()` SQL query.
The new query follows the WP and BP convention of "split" queries: one
for the IDs matching the query parameters, and a second one for the
objects corresponding to the matched IDs. This configuration allows for
improved caching and better performance, especially on installations
with large numbers of groups.
The rewrite serves as a convenient excuse to address a number of
longtime annoyances with the way group queries work:
* Previously, comma syntax was used for table joins, rather than the
`JOIN` keyword. This required some string manipulation when using external
tools for generating SQL fragments, such as `WP_Tax_Query` and
`WP_Meta_Query`. See #5099, #5874. We now use the more standard `JOIN`
syntax.
* The logic for assembling the "total" query is overwhelmingly simpler.
* Previously, group queries required three joined tables: the groups
table, one groupmeta table (for last_activity), and a second groupmeta
table (for total_member_count). After this changeset, these tables will
only be joined when needed for sorting (`orderby` or `type`). The
`last_activity` and `total_member_count` properties, when needed for
display in a group loop, are lazyloaded from groupmeta - where they're
precached by default (see `update_meta_cache`) - rather than pulled as
part of the primary query, and are made available via `__get()` for
backward compatibility.
See #5451, #5874. Fixes #5099.
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5099#comment:15>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list