BP_REST_Account_Settings_Endpoint::get_items( WP_REST_Request $request )
Retrieve Account Settings.
Description
Parameters
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response) | WP_Error
Source
File: bp-settings/classes/class-bp-rest-account-settings-endpoint.php
public function get_items( $request ) { $retval = array(); $navs = array(); global $bp; $tmp_bp = $bp; // Setup Navigation for non admin users. add_filter( 'bp_displayed_user_id', array( $this, 'bp_rest_get_displayed_user' ), 999 ); bp_setup_nav(); remove_filter( 'bp_displayed_user_id', array( $this, 'bp_rest_get_displayed_user' ), 999 ); $user_nav = buddypress()->members->nav; if ( ! empty( $user_nav ) ) { $navs = $user_nav->get_secondary( array( 'parent_slug' => 'settings', 'user_has_access' => true, ) ); } // if it's nouveau then let it order the tabs. if ( function_exists( 'bp_nouveau_set_nav_item_order' ) ) { bp_nouveau_set_nav_item_order( $navs, bp_nouveau_get_appearance_settings( 'user_nav_order' ) ); } if ( ! empty( $navs ) ) { foreach ( $navs as $nav ) { $retval[] = $this->prepare_response_for_collection( $this->prepare_item_for_response( $nav, $request ) ); } } $bp = $tmp_bp; $response = rest_ensure_response( $retval ); /** * Fires after account settings are fetched via the REST API. * * @param array $navs Fetched Navigations. * @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_get_items', $navs, $response, $request ); return $response; }
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
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.