BP_REST_Messages_Endpoint::get_collection_params()
Get the query params for Messages collections.
Description
Return
(array)
Source
File: bp-messages/classes/class-bp-rest-messages-endpoint.php
public function get_collection_params() { $params = parent::get_collection_params(); $params['context']['default'] = 'view'; $boxes = array( 'sentbox', 'inbox' ); if ( bp_is_active( 'messages', 'star' ) ) { $boxes[] = 'starred'; } $params['box'] = array( 'description' => __( 'Filter the result by box.', 'buddyboss' ), 'default' => 'inbox', 'type' => 'string', 'enum' => $boxes, 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['type'] = array( 'description' => __( 'Filter the result by thread status.', 'buddyboss' ), 'default' => 'all', 'type' => 'string', 'enum' => array( 'all', 'read', 'unread' ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['user_id'] = array( 'description' => __( 'Limit result to messages created by a specific user.', 'buddyboss' ), 'default' => bp_loggedin_user_id(), 'type' => 'integer', 'required' => true, 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); /** * Filters the collection query params. * * @param array $params Query params. */ return apply_filters( 'bp_rest_messages_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.