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
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.