BP_REST_Account_Settings_Options_Endpoint::update_notifications_fields( WP_REST_Request $request )
Update notication fields.
Description
- from bp-settings\actions\general.php.
Parameters
- $request
-
(Required) Full details about the request.
Return
(array|bool|void)
Source
File: bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | public function update_notifications_fields( $request ) { $post_fields = $request ->get_param( 'fields' ); $_POST = array (); $_POST [ 'notifications' ] = ( ! empty ( $post_fields ) ? $post_fields : array () ); add_filter( 'bp_displayed_user_id' , array ( $this , 'bp_rest_get_displayed_user' ), 999 ); // phpcs:disable if ( isset( $_POST [ 'notifications' ] ) && ! empty ( $_POST [ 'notifications' ] ) ) { bp_settings_update_notification_settings( bp_displayed_user_id(), ( array ) $_POST [ 'notifications' ] ); } // phpcs:enable remove_filter( 'bp_displayed_user_id' , array ( $this , 'bp_rest_get_displayed_user' ), 999 ); /** * Fires after the notification settings have been saved, and before redirect. * * @since 0.1.0 */ do_action( 'bp_core_notification_settings_after_save' ); return array ( 'error' => false, 'notice' => false, ); } |
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.