Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#7144 closed defect (bug) (fixed)

Group queries with 'group_type' arg return all groups instead matching groups.

Reported by: rekmla Owned by: r-a-y
Milestone: 2.6.1 Priority: normal
Severity: normal Version: 2.6.0
Component: Groups Keywords: has-patch
Cc:

Description

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

All groups are being returned, not just groups with a specific group type. I've traced the problem to the function get_sql_clause_for_group_types() in the class BP_Groups_Group 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.

Attachments (1)

7144.patch (724 bytes) - added by rekmla 3 years ago.

Download all attachments as: .zip

Change History (4)

@rekmla
3 years ago

#1 @r-a-y
3 years ago

  • Milestone changed from Awaiting Review to 2.6.1

#2 @r-a-y
3 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 10912:

Taxonomy: Fix usage of restore_current_blog() when using bp_get_taxonomy_term_site_id().

See #7077 where we introduced bp_get_taxonomy_term_site_id().

Props remkla.

Fixes #7142, #7144 (2.6-branch).

#3 @r-a-y
3 years ago

In 10913:

Taxonomy: Fix usage of restore_current_blog() when using bp_get_taxonomy_term_site_id().

See #7077 where we introduced bp_get_taxonomy_term_site_id().

Props remkla.

Fixes #7142, #7144 (trunk).

Note: See TracTickets for help on using tickets.