ackward compat. $sub_nav[] = array( 'name' => __( 'Email', 'buddypress' ), 'slug' => 'notifications', 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => false, 'user_has_access_callback' => 'bp_core_can_edit_settings', ); $sub_nav[] = array( 'name' => _x( 'Profile Visibility', 'Profile settings sub nav', 'buddypress' ), 'slug' => 'profile', 'parent_slug' => $slug, 'screen_function' => 'bp_xprofile_screen_settings', 'position' => 30, 'user_has_access' => false, 'user_has_access_callback' => 'bp_core_can_edit_settings', ); $sub_nav[] = array( 'name' => __( 'Capabilities', 'buddypress' ), 'slug' => 'capabilities', 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => false, 'user_has_access_callback' => 'bp_settings_show_capability_nav', 'generate' => bp_current_user_can( 'bp_moderate' ), ); /** * Filter whether the site should show the "Settings > Data" page. * * @since 4.0.0 * * @param bool $show Defaults to true. */ $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true ); // Export Data. if ( true === $show_data_page ) { $sub_nav[] = array( 'name' => __( 'Export Data', 'buddypress' ), 'slug' => 'data', 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_data', 'position' => 89, 'user_has_access' => false, 'user_has_access_callback' => 'bp_core_can_edit_settings', ); } // Add Delete Account nav item. $sub_nav[] = array( 'name' => __( 'Delete Account', 'buddypress' ), 'slug' => 'delete-account', 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => false, 'user_has_access_callback' => 'bp_settings_can_delete_self_account', 'generate' => 'bp_settings_show_delete_account_nav', ); parent::register_nav( $main_nav, $sub_nav ); } /** * Set up the component entries in the WordPress Admin Bar. * * @since 1.5.0 * * @see `BP_Component::setup_admin_bar()` for a description of the $wp_admin_nav * parameter array. * * @param array $wp_admin_nav See `BP_Component::setup_admin_bar()` for a * description. */ public function setup_admin_bar( $wp_admin_nav = array() ) { // Menus for logged in user. if ( is_user_logged_in() ) { $settings_slug = bp_get_settings_slug(); // Add main Settings menu. $wp_admin_nav[] = array( 'parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __( 'Settings', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $settings_slug ) ) ), ); // General Account. $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-general', 'title' => __( 'General', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $settings_slug, 'general' ) ) ), 'position' => 10, ); // Notifications - only add the tab when there is something to display there. if ( has_action( 'bp_notification_settings' ) ) { $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-notifications', 'title' => __( 'Email', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $settings_slug, 'notifications' ) ) ), 'position' => 20, ); } /** This filter is documented in bp-settings/classes/class-bp-settings-component.php */ $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true ); // Export Data. if ( true === $show_data_page ) { $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-data', 'title' => __( 'Export Data', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $settings_slug, 'data' ) ) ), 'position' => 89, ); } // Delete Account if ( ! bp_current_user_can( 'bp_moderate' ) && ! bp_core_get_root_option( 'bp-disable-account-deletion' ) ) { $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-delete-account', 'title' => __( 'Delete Account', 'buddypress' ), 'href' => bp_loggedin_user_url( bp_members_get_path_chunks( array( $settings_slug, 'delete-account' ) ) ), 'position' => 90, ); } } parent::setup_admin_bar( $wp_admin_nav ); } /** * Register the BP Settings Blocks. * * @since 9.0.0 * * @param array $blocks Optional. See BP_Component::blocks_init() for the description. */ public function blocks_init( $blocks = array() ) { parent::blocks_init( array() ); } }