• Knowledge Base
    • All Articles
    • BuddyBoss Platform
    • BuddyBoss Theme
    • BuddyBoss App
    • Integrations
    • Advanced Setup
    • Troubleshooting
    • Release Notes
      • BuddyBoss Platform
      • BuddyBoss Platform Pro
      • BuddyBoss Theme
      • BuddyBoss App
      • BuddyBoss App Plugin
      • Other Products
  • Developers
    • Developer Tutorials
      • Web Development
      • App Development
    • Code Reference
      • Functions
      • Hooks
      • Classes
      • Methods
      • Commands
      • App Codex
    • REST API
      • BuddyBoss Platform
      • BuddyBoss App
    • Font Cheatsheet
    • Github Project
  • Roadmap
  • Go to BuddyBoss
    Contact Support
    Filter
    • Knowledge Base
      • All Articles
      • BuddyBoss Platform
      • BuddyBoss Theme
      • BuddyBoss App
      • Integrations
      • Advanced Setup
      • Troubleshooting
      • Release Notes
        • BuddyBoss Platform
        • BuddyBoss Platform Pro
        • BuddyBoss Theme
        • BuddyBoss App
        • BuddyBoss App Plugin
        • Other Products
    • Developers
      • Developer Tutorials
        • Web Development
        • App Development
      • Code Reference
        • Functions
        • Hooks
        • Classes
        • Methods
        • Commands
        • App Codex
      • REST API
        • BuddyBoss Platform
        • BuddyBoss App
      • Font Cheatsheet
      • Github Project
    • Roadmap
    • Go to BuddyBoss
    Filter
    Filter

    Contents

    • Description
    • Parameters
    • Return
    • Source
    • Related
    Code Reference Classes BP_REST_Account_Settings_Options_Endpoint BP_REST_Account_Settings_Options_Endpoint::update_notifications_fields()

    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

    (WP_REST_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,
    		);
    	}
    

    Expand full source code Collapse full source code

    Related

    Uses

    Uses
    Uses Description
    bp-settings/bp-settings-functions.php: bp_settings_update_notification_settings()

    Update email notification settings for a specific user.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: bp_core_notification_settings_after_save

    Fires after the notification settings have been saved, and before redirect.

    bp-core/bp-core-template.php: bp_displayed_user_id()

    Get the ID of the currently displayed user.

    Used By
    Used By Description
    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_item()

    Update Account Settings options.

    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.

    © 2022 • BuddyBoss