BP_REST_Account_Settings_Options_Endpoint:: update_item (WP_REST_Request美元的请求)
更新帐户设置选项。
描述
参数
- 美元的请求
-
(WP_REST_Request)(必需)请求的全部细节。
返回
(WP_Error)| WP_REST_Response
源
文件:bp-settings /类/ class-bp-rest-account-settings-options-endpoint.php
公共函数update_item($request) {$nav = $request->get_param('nav');$ =字段数组();$ =更新数组();Switch ($nav) {case 'general': $update = $this->update_general_fields($request);$ = $ this - >字段get_general_fields ();打破;Case 'notifications': $update = $this->update_notifications_fields($request);$ = $ this - >字段get_notifications_fields ();打破;Case 'profile': $update = $this->update_profile_fields($request); $fields = $this->get_profile_fields(); break; case 'invites': $updated = $this->update_invites_fields( $request ); $fields = $this->get_invites_fields(); break; case 'export': $updated = $this->update_export_fields( $request ); $fields = $this->get_export_fields(); break; case 'delete-account': $updated = $this->update_delete_account_fields( $request ); $fields = $this->get_delete_account_fields(); break; } $fields = apply_filters( 'bp_rest_account_setting_update_fields', $fields, $nav ); $updated = apply_filters( 'bp_rest_account_setting_update_message', $updated, $nav ); $fields_update = $this->update_additional_fields_for_object( $nav, $request ); if ( is_wp_error( $fields_update ) ) { return $fields_update; } $data = array(); if ( ! empty( $fields ) ) { foreach ( $fields as $field ) { $data[] = $this->prepare_response_for_collection( $this->prepare_item_for_response( $field, $request ) ); } } $retval = array( 'error' => ( isset( $updated['error'] ) ? $updated['error'] : false ), 'notices' => ( isset( $updated['notice'] ) ? $updated['notice'] : false ), 'data' => $data, ); $response = rest_ensure_response( $retval ); /** * Fires after account setting options are updated via the REST API. * * @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_account_settings_options_update_item', $response, $request ); return $response; }
更新日志
版本 | 描述 |
---|---|
0.1.0 | 介绍了。 |