Skip to:
Content

BuddyPress.org

Changeset 9661


Ignore:
Timestamp:
03/30/2015 06:41:38 PM (4 years ago)
Author:
boonebgorges
Message:

Better logic for blog switching when processing member type tax query.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-user-query.php

    r9586 r9661  
    446446
    447447                // Switch to the root blog, where member type taxonomies live.
    448                 switch_to_blog( bp_get_root_blog_id() );
     448                $switched = false;
     449                if ( ! bp_is_root_blog() ) {
     450                    switch_to_blog( bp_get_root_blog_id() );
     451                    $switched = true;
     452                }
    449453
    450454                $member_type_sql_clauses = $member_type_tq->get_sql( 'u', $this->uid_name );
    451                 restore_current_blog();
    452 
    453 
     455
     456                if ( $switched ) {
     457                    restore_current_blog();
     458                }
    454459
    455460                // Grab the first term_relationships clause and convert to a subquery.
Note: See TracChangeset for help on using the changeset viewer.