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
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | 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.