[buddypress-trac] [BuddyPress Trac] #5874: BP_Groups_Group::get() returns incorrect results when using meta_query with multiple meta_values and OR relationship

buddypress-trac noreply at wordpress.org
Fri Sep 9 15:00:14 UTC 2016


#5874: BP_Groups_Group::get() returns incorrect results when using meta_query with
multiple meta_values and OR relationship
--------------------------+-----------------------------
 Reporter:  richtelford   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Groups        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+-----------------------------

Comment (by boonebgorges):

 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/5874#comment:24>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list