[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
Sun Jun 26 20:42:19 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:  normal        |   Milestone:  Awaiting Review
Component:  Members       |     Version:  2.6.0
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------
Changes (by rekmla):

 * priority:  high => normal


Comment:

 Update on recreating this issue. This is a similar issue to the issue
 reported in [https://buddypress.trac.wordpress.org/ticket/7144].

 This issue occurs when using the 'bp_get_taxonomy_term_site_id' filter to
 override the default table location for the 'bp_member_type' taxonomy.

 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. The match is failing if the value of
 `$wpdb->term_relationships` is different than the value at the time the
 taxonomy query is generated.

 This is because restore_current_blog() happens too early resulting in the
 wrong `$wpdb->term_relationships` value being used in the match.

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


More information about the buddypress-trac mailing list