[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
Mon Sep 15 13:33:57 UTC 2014


#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:  Awaiting Review
Component:  Groups        |     Version:
 Severity:  major         |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by boonebgorges):

 >  I know that joining tables together with comma syntax can be
 problematic - as is hinted at in the get_meta_query_sql() code. When
 debugging this initially, I took the SQL output created by
 get_meta_query_sql() and get() from bp-groups-classes.php, dropped it into
 Navicat to see what was going on. The first thing I tried was replacing
 the comma joins with inner joins and the problem (which I'm experiencing)
 was sorted. So perhaps the problem is related to ambiguous joins.

 As noted above and in the comments to the code, the INNER JOINs from
 WP_Meta_Query are supposed to be swapped out with the proper comma syntax
 in get_meta_query_sql(). If this is not happening - if the SQL being
 returned from get_meta_query_sql() still contains INNER JOINs (and the
 WHERE clause does not contain the necessary column mappings that are
 produced by ON in the case of JOINs), then there something is awry in
 get_meta_query_sql(). I'd urge you to debug there a bit more, or, barring
 that, please share the SQL chunks that are being passed into and out of
 get_meta_query_sql()

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5874#comment:8>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list