Changeset 9936 for trunk/src/bp-settings/bp-settings-loader.php
- Timestamp:
- 06/11/2015 06:53:59 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-settings/bp-settings-loader.php
r9819 r9936 31 31 /** 32 32 * Include files 33 *34 * @global BuddyPress $bp The one true BuddyPress instance35 33 */ 36 34 public function includes( $includes = array() ) { … … 54 52 55 53 // Define a slug, if necessary 56 if ( ! defined( 'BP_SETTINGS_SLUG' ) )54 if ( ! defined( 'BP_SETTINGS_SLUG' ) ) { 57 55 define( 'BP_SETTINGS_SLUG', $this->id ); 56 } 58 57 59 58 // All globals for settings component. … … 68 67 */ 69 68 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 70 71 // Add the settings navigation item72 $main_nav = array(73 'name' => __( 'Settings', 'buddypress' ),74 'slug' => $this->slug,75 'position' => 100,76 'show_for_displayed_user' => bp_core_can_edit_settings(),77 'screen_function' => 'bp_settings_screen_general',78 'default_subnav_slug' => 'general'79 );80 69 81 70 // Determine user to use … … 88 77 } 89 78 90 $settings_link = trailingslashit( $user_domain . $this->slug ); 79 $access = bp_core_can_edit_settings(); 80 $slug = bp_get_settings_slug(); 81 $settings_link = trailingslashit( $user_domain . $slug ); 82 83 // Add the settings navigation item 84 $main_nav = array( 85 'name' => __( 'Settings', 'buddypress' ), 86 'slug' => $slug, 87 'position' => 100, 88 'show_for_displayed_user' => $access, 89 'screen_function' => 'bp_settings_screen_general', 90 'default_subnav_slug' => 'general' 91 ); 91 92 92 93 // Add General Settings nav item … … 95 96 'slug' => 'general', 96 97 'parent_url' => $settings_link, 97 'parent_slug' => $ this->slug,98 'parent_slug' => $slug, 98 99 'screen_function' => 'bp_settings_screen_general', 99 100 'position' => 10, 100 'user_has_access' => bp_core_can_edit_settings()101 'user_has_access' => $access 101 102 ); 102 103 … … 107 108 'slug' => 'notifications', 108 109 'parent_url' => $settings_link, 109 'parent_slug' => $ this->slug,110 'parent_slug' => $slug, 110 111 'screen_function' => 'bp_settings_screen_notification', 111 112 'position' => 20, 112 'user_has_access' => bp_core_can_edit_settings()113 'user_has_access' => $access 113 114 ); 114 115 … … 119 120 'slug' => 'capabilities', 120 121 'parent_url' => $settings_link, 121 'parent_slug' => $ this->slug,122 'parent_slug' => $slug, 122 123 'screen_function' => 'bp_settings_screen_capabilities', 123 124 'position' => 80, … … 132 133 'slug' => 'delete-account', 133 134 'parent_url' => $settings_link, 134 'parent_slug' => $ this->slug,135 'parent_slug' => $slug, 135 136 'screen_function' => 'bp_settings_screen_delete_account', 136 137 'position' => 90, … … 147 148 public function setup_admin_bar( $wp_admin_nav = array() ) { 148 149 149 // The instance150 $bp = buddypress();151 152 150 // Menus for logged in user 153 151 if ( is_user_logged_in() ) { 154 152 155 153 // Setup the logged in user variables 156 $user_domain = bp_loggedin_user_domain(); 157 $settings_link = trailingslashit( $user_domain . $this->slug ); 154 $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() ); 158 155 159 156 // Add main Settings menu 160 157 $wp_admin_nav[] = array( 161 'parent' => $bp->my_account_menu_id,158 'parent' => buddypress()->my_account_menu_id, 162 159 'id' => 'my-account-' . $this->id, 163 160 'title' => __( 'Settings', 'buddypress' ), 164 'href' => trailingslashit( $settings_link )161 'href' => $settings_link 165 162 ); 166 163 … … 170 167 'id' => 'my-account-' . $this->id . '-general', 171 168 'title' => __( 'General', 'buddypress' ), 172 'href' => trailingslashit( $settings_link . 'general' )169 'href' => $settings_link 173 170 ); 174 171
Note: See TracChangeset
for help on using the changeset viewer.