[buddypress-trac] [BuddyPress Trac] #7142: User queries using the 'bp_pre_user_query_construct' action to filter 'member_type' return all members instead matching members.

buddypress-trac noreply at wordpress.org
Sat Jun 25 18:53:01 UTC 2016


#7142: User queries using the 'bp_pre_user_query_construct' action to filter
'member_type' return all members instead matching members.
--------------------------+-----------------------------
 Reporter:  rekmla        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  high          |  Milestone:  Awaiting Review
Component:  Members       |    Version:  2.6.0
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 We're attempting to set {{{query_vars['member_type']}}} using the
 'bp_pre_user_query_construct' action. All members are being returned, not
 just members with a specific member type. I've traced the problem to the
 function get_sql_clause_for_member_types() in the class BP_User_Query
 which is failing to preg_match the where clause of the intermediate
 taxonomy query this function performs. Said where clause has a leading
 'AND' and is wrapped in '()' which is not accounted for in the regex used
 when converting this clause to a subquery.

 A second issue found is that restore_current_blog() happens too early
 resulting in the wrong $wpdb->term_relationships value being used in this
 optimization.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7142>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list