BP_REST_Invites_Endpoint:: get_item (WP_REST_Request美元的请求)
发送邀请。
描述
参数
- 美元的请求
-
(WP_REST_Request)(必需)请求的全部细节。
返回
(WP_REST_Response)| WP_Error bp-invite post的对象数据列表。
源
文件:bp-invites /类/ class-bp-rest-invites-endpoint.php
Public function get_items($request) {$args = array('post_type' => bp_get_invite_post_type(), 'author' => (int) get_current_user_id(), ' page_' => (!Empty ($request['page']) ?$request['page']: "), 'posts_per_page' => (!Empty ($request['per_page']) ?$request['per_page']: "), 'orderby' => (!null ($request['orderby']) ?$request['orderby']: 'date'), 'order' => (!空($request['order']) ?$request['order']: 'desc'),);$invites_query = new WP_Query($args); $sent_invites = ( ! empty( $invites_query->posts ) ? $invites_query->posts : array() ); $retval = array(); foreach ( $sent_invites as $invite ) { $retval[] = $this->prepare_response_for_collection( $this->prepare_item_for_response( $invite, $request ) ); } wp_reset_postdata(); $response = rest_ensure_response( $retval ); $response = bp_rest_response_add_total_headers( $response, $invites_query->found_posts, $args['posts_per_page'] ); /** * Fires after a list of sent invites is fetched via the REST API. * * @param array $sent_invites Fetched Invites. * @param WP_REST_Response $response The response data. * @param WP_REST_Request $request The request sent to the API. * * @since 0.1.0 */ do_action( 'bp_rest_invites_get_items', $sent_invites, $response, $request ); return $response; }
更新日志
版本 | 描述 |
---|---|
0.1.0 | 介绍了。 |