BP_REST_Forums_Endpoint::get_collection_params()
Get the query params for collections.
Description
Return
(array)
Source
File: bp-forums/classes/class-bp-rest-forums-endpoint.php
public function get_collection_params() { $params = parent::get_collection_params(); $params['context']['default'] = 'view'; $params['per_page']['default'] = ( function_exists( 'bbp_get_forums_per_page' ) ? bbp_get_forums_per_page() : get_option( '_bbp_forums_per_page', 15 ) ); $params['author'] = array( 'description' => __( 'Author ID, or comma-separated list of IDs.', 'buddyboss' ), 'default' => '', 'type' => 'string', 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['author_exclude'] = array( 'description' => __( 'An array of author IDs not to query from.', 'buddyboss' ), 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude'] = array( 'description' => __( 'An array of forums IDs not to retrieve.', 'buddyboss' ), 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['include'] = array( 'description' => __( 'An array of forums IDs to retrieve.', 'buddyboss' ), 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['offset'] = array( 'description' => __( 'The number of forums to offset before retrieval.', 'buddyboss' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( 'description' => __( 'Designates ascending or descending order of forums.', 'buddyboss' ), 'default' => 'asc', 'type' => 'string', 'enum' => array( 'asc', 'desc' ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['orderby'] = array( 'description' => __( 'Sort retrieved forums by parameter.', 'buddyboss' ), 'type' => 'array', 'items' => array( 'type' => 'string', 'enum' => array( 'date', 'ID', 'author', 'title', 'name', 'modified', 'parent', 'rand', 'menu_order', 'relevance', 'popular', 'activity', ), ), 'sanitize_callback' => 'bp_rest_sanitize_string_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['status'] = array( 'description' => __( 'Limit result set to forums assigned a specific status.', 'buddyboss' ), 'default' => array( 'publish', 'private' ), 'type' => 'array', 'items' => array( 'type' => 'string', 'enum' => array( 'publish', 'private', 'hidden' ), ), 'sanitize_callback' => 'bp_rest_sanitize_string_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['parent'] = array( 'description' => __( 'Forum ID to retrieve child pages for. Use 0 to only retrieve top-level forums.', 'buddyboss' ), 'default' => '0', 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['subscriptions'] = array( 'description' => __( 'Retrieve subscribed forums by user.', 'buddyboss' ), 'default' => false, 'type' => 'boolean', 'validate_callback' => 'rest_validate_request_arg', ); /** * Filters the collection query params. * * @param array $params Query params. */ return apply_filters( 'bp_rest_forums_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.