• 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
    • Changelog
    • Related
    Code Reference Classes BP_REST_Account_Settings_Options_Endpoint BP_REST_Account_Settings_Options_Endpoint::update_item()

    BP_REST_Account_Settings_Options_Endpoint::update_item( WP_REST_Request $request )

    Update Account Settings options.

    Description

    Parameters

    $request

    (Required) Full details about the request.

    Return

    (WP_Error) | WP_REST_Response

    Source

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

    	public function update_item( $request ) {
    		$nav     = $request->get_param( 'nav' );
    		$fields  = array();
    		$updated = array();
    
    		switch ( $nav ) {
    			case 'general':
    				$updated = $this->update_general_fields( $request );
    				$fields  = $this->get_general_fields();
    				break;
    
    			case 'notifications':
    				$updated = $this->update_notifications_fields( $request );
    				$fields  = $this->get_notifications_fields();
    				break;
    
    			case 'profile':
    				$updated = $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;
    	}
    

    Expand full source code Collapse full source code

    Changelog

    Changelog
    Version Description
    0.1.0 Introduced.

    Related

    Uses

    Uses
    Uses Description
    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_general_fields()

    Update general fields.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::get_general_fields()

    Get Fields for the General “Login Information”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_notifications_fields()

    Update notication fields.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::get_notifications_fields()

    Get Fields for the Notifications “Email Preferences”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_profile_fields()

    Update profile fields.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::get_profile_fields()

    Get Fields for the Profile “Privacy”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_invites_fields()

    Update Invites fields “Group Invites”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::get_invites_fields()

    Get Fields for the Invites “Group Invites”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_export_fields()

    Update Export fields “Export Data”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::get_export_fields()

    Get Fields for the Export “Export Data”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::update_delete_account_fields()

    Delete Account “Export Data”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::get_delete_account_fields()

    Get Fields for the Delete Account “Delete Account”.

    bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php: BP_REST_Account_Settings_Options_Endpoint::prepare_item_for_response()

    Prepares account settings data for return as an object.

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

    Fires after account setting options are updated via the REST API.

    Show 9 more uses Hide more uses

    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.

    © 2025 • BuddyBoss