• 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_Endpoint BP_REST_Account_Settings_Endpoint::prepare_item_for_response()

    BP_REST_Account_Settings_Endpoint::prepare_item_for_response( object $nav, WP_REST_Request $request )

    Prepares account settings data for return as an object.

    Description

    Parameters

    $nav

    (Required) Navigation object.

    $request

    (Required) Full details about the request.

    Return

    (WP_REST_Response)

    Source

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

    	public function prepare_item_for_response( $nav, $request ) {
    		$data = array(
    			'name'     => $nav->name,
    			'slug'     => $nav->slug,
    			'position' => $nav->position,
    			'link'     => $nav->link,
    		);
    
    		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
    		$data    = $this->add_additional_fields_to_object( $data, $request );
    		$data    = $this->filter_response_by_context( $data, $context );
    
    		// @todo add prepare_links
    		$response = rest_ensure_response( $data );
    
    		$response->add_links( $this->prepare_links( $data['slug'] ) );
    
    		/**
    		 * Filter a notification value returned from the API.
    		 *
    		 * @param WP_REST_Response $response The response data.
    		 * @param WP_REST_Request  $request  Request used to generate the response.
    		 * @param object           $nav      Navigation object.
    		 *
    		 * @since 0.1.0
    		 */
    		return apply_filters( 'bp_rest_account_setting_prepare_value', $response, $request, $nav );
    	}
    

    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-endpoint.php: BP_REST_Account_Settings_Endpoint::prepare_links()

    Prepare links for the request.

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

    Filter a notification value returned from the API.

    Used By
    Used By Description
    bp-settings/classes/class-bp-rest-account-settings-endpoint.php: BP_REST_Account_Settings_Endpoint::get_items()

    Retrieve Account Settings.

    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