BP_REST_Group_Invites_Endpoint::get_collection_params()

Get the query params for collections of group invites.

Description

Return

(array)

Source

File: bp-groups/classes/class-bp-rest-group-invites-endpoint.php

1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
public function get_collection_params() {
    $params                       = parent::get_collection_params();
    $params['context']['default'] = 'view';
 
    // Remove the search param.
    unset( $params['search'] );
 
    $params['group_id'] = array(
        'description'       => __( 'ID of the group to limit results to.', 'buddyboss' ),
        'required'          => false,
        'default'           => 0,
        'type'              => 'integer',
        'sanitize_callback' => 'absint',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['user_id'] = array(
        'description'       => __( 'Return only invitations extended to this user.', 'buddyboss' ),
        'required'          => false,
        'default'           => 0,
        'type'              => 'integer',
        'sanitize_callback' => 'absint',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['inviter_id'] = array(
        'description'       => __( 'Return only invitations extended by this user.', 'buddyboss' ),
        'required'          => false,
        'default'           => 0,
        'type'              => 'integer',
        'sanitize_callback' => 'absint',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['invite_sent'] = array(
        'description'       => __( 'Limit result set to invites that have been sent, not sent, or include all.', 'buddyboss' ),
        'default'           => 'sent',
        'type'              => 'string',
        'sanitize_callback' => 'sanitize_text_field',
        'validate_callback' => 'rest_validate_request_arg',
        'enum'              => array( 'draft', 'sent', 'all' ),
    );
 
    /**
     * Filters the collection query params.
     *
     * @param array $params Query params.
     */
    return apply_filters( 'bp_rest_group_invites_collection_params', $params );
}

Changelog

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.