Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/06/2016 02:02:37 AM (5 years ago)
Author:
dcavins
Message:

Improve BP_Groups_Group::filter_user_groups().

Add a preceding wildcard to the LIKE search terms statement in
BP_Groups_Group::filter_user_groups(). Before this change, the
function would only find group names and descriptions that started with
the search string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-group.php

    r10766 r10937  
    614614    }
    615615
     616    public function test_filter_user_groups_normal_search_middle_of_string() {
     617        $g1 = $this->factory->group->create( array(
     618            'name' => 'Cool Group',
     619            'description' => 'This group is for mandocellos and oboes.',
     620        ) );
     621        $g2 = $this->factory->group->create();
     622        $u = $this->factory->user->create();
     623        self::add_user_to_group( $u, $g1 );
     624
     625        $groups = BP_Groups_Group::filter_user_groups( 'cello', $u );
     626
     627        $found = wp_list_pluck( $groups['groups'], 'group_id' );
     628        $this->assertEquals( array( $g1 ), $found );
     629    }
     630
    616631    public function test_filter_user_groups_search_with_underscores() {
    617632        $g1 = $this->factory->group->create( array(
Note: See TracChangeset for help on using the changeset viewer.