Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/30/2015 06:44:55 PM (11 years ago)
Author:
boonebgorges
Message:

Enforce no_results when getting a 0=1 result from the member type tax query.

When passing a 'member_type' to BP_User_Query and no users belong to the
member type, the WP_Tax_Query transformation will return a '0 = 1' clause to
indicate that no results were found. We should respect this result, so that no
members are returned for this kind of query.

Fixes #6334 for the 2.2 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/tests/phpunit/testcases/core/class-bp-user-query.php

    r9534 r9663  
    498498        }
    499499
     500        /**
     501         * @group member_types
     502         * @ticket BP6334
     503         */
     504        public function test_should_return_no_results_when_no_users_match_the_specified_member_type() {
     505                bp_register_member_type( 'foo' );
     506                $users = $this->factory->user->create_many( 3 );
     507
     508                $q = new BP_User_Query( array(
     509                        'member_type' => 'foo, baz',
     510                ) );
     511
     512                $this->assertEmpty( $q->results );
     513        }
    500514
    501515        /**
Note: See TracChangeset for help on using the changeset viewer.