bp_rest_notifications_endpoint :: create_item(wp_rest_request.$请求的)

创建通知。

描述

参数

$请求

wp_rest_request.的)(必需的)有关该请求的完整数据。

返回

(wp_rest_response)|wp_error.

来源

文件:BP-notifications / classes / class-bp-rest-notifications-endpoint.php

公共函数create_item($请求){//设置上下文。$请求 - > set_param('context','编辑');$ notification_id = bp_notifications_notification($ this-> prequest_item_for_database($请求));if(!is_numeric($ notification_id)){return new wp_error('bp_rest_user_cannot_cantexe_notification',__('无法创建新通知'),'buddyboss'),array('status' => 500,));$ notification = $ this-> get_notification_object($ notification_id);$ fields_update = $ this-> update_additional_fields_for_object($通知,$请求);if(is_wp_error($ fields_update)){return $ fields_update;$ retval = $ this-> prequest_response_for_collection($ this-> prefer_item_for_response($通知,$请求));$ response = rest_ensure_response($ retval);/ ** *通过REST API创建通知后的触发。 * * @param BP_Notifications_Notification $notification The created notification. * @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_notifications_create_item', $notification, $response, $request ); return $response; }

变更乐

变更乐
版本 描述
0.1.0. 介绍。

问题?

我们总是很乐意帮助您可能拥有的代码或其他问题!搜索我们开发人员文档联系支持,或与我们联系销售团队