Skip to:
Content

BuddyPress.org

Changeset 11595


Ignore:
Timestamp:
06/21/2017 04:55:44 PM (8 years ago)
Author:
dcavins
Message:

Correct search_term parameter in bp_group_has_members().

The function bp_group_has_members() defaults the query parameter
search_terms to null when there are no search terms, but
BP_User_Query expects search_terms to be false rather than null
when a search is not needed.

Props brandonliles.

Fixes #7513.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-template.php

    r11531 r11595  
    38653865 *     @type string   $search_terms       Optional. Search terms to match. Pass an
    38663866 *                                        empty string to force-disable search, even in
    3867  *                                        the presence of $_REQUEST['s']. Default: null.
     3867 *                                        the presence of $_REQUEST['s']. Default: false.
    38683868 * }
    38693869 *
     
    38793879    }
    38803880
    3881     $search_terms_default = null;
     3881    /*
     3882     * Use false as the search_terms default so that BP_User_Query
     3883     * doesn't add a search clause.
     3884     */
     3885    $search_terms_default = false;
    38823886    $search_query_arg = bp_core_get_component_search_query_arg( 'members' );
    38833887    if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) {
     
    38983902    ) );
    38993903
    3900     if ( is_null( $r['search_terms'] ) && ! empty( $_REQUEST['s'] ) ) {
     3904    /*
     3905     * If an empty search_terms string has been passed,
     3906     * the developer is force-disabling search.
     3907     */
     3908    if ( '' === $r['search_terms'] ) {
     3909        // Set the search_terms to false for BP_User_Query efficiency.
     3910        $r['search_terms'] = false;
     3911    } elseif ( ! empty( $_REQUEST['s'] ) ) {
    39013912        $r['search_terms'] = $_REQUEST['s'];
    39023913    }
Note: See TracChangeset for help on using the changeset viewer.