[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 15:08:23 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 richtelford):

 the second and third clauses do not contain corresponding subclauses

 That's kinda what I meant by improper bracketing.

 I've got latest BP trunk running on my localhost site but still same
 issue. The SQL output from that is:

 {{{
 SELECT DISTINCT g.id, g.*, gm1.meta_value AS total_member_count,
 gm2.meta_value AS last_activity
 FROM wp_bp_groups_groupmeta gm1, wp_bp_groups_groupmeta
 gm2,wp_bp_groups_groupmeta,wp_bp_groups_groupmeta AS
 mt1,wp_bp_groups_groupmeta AS mt2, wp_bp_groups g WHERE g.id =
 gm1.group_id
 AND g.id = gm2.group_id
 AND gm2.meta_key = 'last_activity'
 AND gm1.meta_key = 'total_member_count'
 AND g.status != 'hidden'
 AND ( (g.id = wp_bp_groups_groupmeta.group_id
 AND wp_bp_groups_groupmeta.meta_key = 'sport'
 AND CAST(wp_bp_groups_groupmeta.meta_value AS CHAR) LIKE '%running%')
 OR (mt1.meta_key = 'sport' AND CAST(mt1.meta_value AS CHAR) LIKE
 '%mountain%')
 OR (mt2.meta_key = 'sport' AND CAST(mt2.meta_value AS CHAR) LIKE
 '%winter%') )
 ORDER BY g.date_created DESC
 }}}

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


More information about the buddypress-trac mailing list