Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/09/2020 01:25:47 PM (5 years ago)
Author:
dcavins
Message:

Support status parameter in bp_has_groups().

Allow a status parameter to be passed through bp_has_groups() to its underlying function, groups_has_groups().

Fixes #8310.

File:
1 edited

Legend:

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

    r12647 r12744  
    294294 * @since 2.6.0 Added `$group_type`, `$group_type__in`, and `$group_type__not_in` parameters.
    295295 * @since 2.7.0 Added `$update_admin_cache` parameter.
     296 * @since 7.0.0 Added `$status` parameter.
    296297 *
    297298 * @param array|string $args {
     
    320321 *     @type array|string $group_type__not_in Array or comma-separated list of group types that will be
    321322 *                                            excluded from results.
     323 *     @type array|string $status             Array or comma-separated list of group statuses to limit results to.
    322324 *     @type array        $meta_query         An array of meta_query conditions.
    323325 *                                            See {@link WP_Meta_Query::queries} for description.
     
    370372            // Can be a comma-separated list.
    371373            $group_type = explode( ',', $_GET['group_type'] );
     374        }
     375    }
     376
     377    $status = array();
     378    if ( ! empty( $_GET['status'] ) ) {
     379        if ( is_array( $_GET['status'] ) ) {
     380            $status = $_GET['status'];
     381        } else {
     382            // Can be a comma-separated list.
     383            $status = explode( ',', $_GET['status'] );
    372384        }
    373385    }
     
    399411        'group_type__in'     => '',
    400412        'group_type__not_in' => '',
     413        'status'             => $status,
    401414        'meta_query'         => false,
    402415        'include'            => false,
     
    423436        'group_type__in'     => $r['group_type__in'],
    424437        'group_type__not_in' => $r['group_type__not_in'],
     438        'status'             => $r['status'],
    425439        'meta_query'         => $r['meta_query'],
    426440        'include'            => $r['include'],
Note: See TracChangeset for help on using the changeset viewer.