BP_REST_Group_Membership_Endpoint::get_collection_params()
Get the query params for collections of group memberships.
Description
Return
(array)
Source
File: bp-groups/classes/class-bp-rest-group-membership-endpoint.php
public function get_collection_params() { $params = parent::get_collection_params(); $params['context']['default'] = 'view'; $statuses = array( 'last_joined', 'first_joined', 'alphabetical', 'group_role' ); if ( bp_is_active( 'activity' ) ) { $statuses[] = 'group_activity'; } $params['status'] = array( 'description' => __( 'Sort the order of results by the status of the group members.', 'buddyboss' ), 'default' => 'last_joined', 'type' => 'string', 'enum' => $statuses, 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['roles'] = array( 'description' => __( 'Ensure result set includes specific group roles.', 'buddyboss' ), 'default' => array(), 'type' => 'array', 'items' => array( 'type' => 'string', 'enum' => array_keys( bp_groups_get_group_roles() ), ), 'sanitize_callback' => 'bp_rest_sanitize_string_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude'] = array( 'description' => __( 'Ensure result set excludes specific member IDs.', 'buddyboss' ), 'default' => array(), 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude_admins'] = array( 'description' => __( 'Whether results should exclude group admins and mods.', 'buddyboss' ), 'default' => true, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude_banned'] = array( 'description' => __( 'Whether results should exclude banned group members.', 'buddyboss' ), 'default' => true, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $params['scope'] = array( 'description' => __( 'Limit result set to items with a specific scope.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'view' ), 'enum' => array( 'invite', 'invite-friends', 'invited' ), 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); /** * Filters the collection query params. * * @param array $params Query params. */ return apply_filters( 'bp_rest_group_members_collection_params', $params ); }
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.