- Timestamp:
- 04/12/2023 10:12:37 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/classes/class-bp-xprofile-component.php
r13442 r13450 221 221 222 222 /** 223 * Set up navigation. 224 * 225 * @since 1.5.0 226 * 227 * @param array $main_nav Array of main nav items to set up. 228 * @param array $sub_nav Array of sub nav items to set up. 229 */ 230 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 231 232 // Stop if there is no user displayed or logged in. 233 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 234 return; 235 } 236 237 $access = bp_core_can_edit_settings(); 238 $slug = bp_get_profile_slug(); 223 * Register component navigation. 224 * 225 * @since 12.0.0 226 * 227 * @param array $main_nav See `BP_Component::register_nav()` for details. 228 * @param array $sub_nav See `BP_Component::register_nav()` for details. 229 */ 230 public function register_nav( $main_nav = array(), $sub_nav = array() ) { 231 $slug = bp_get_profile_slug(); 239 232 240 233 // Add 'Profile' to the main navigation. … … 259 252 // Edit Profile. 260 253 $sub_nav[] = array( 261 'name' => _x( 'Edit','Profile header sub menu', 'buddypress' ), 262 'slug' => 'edit', 263 'parent_slug' => $slug, 264 'screen_function' => 'xprofile_screen_edit_profile', 265 'position' => 20, 266 'user_has_access' => $access, 267 ); 268 269 // The Settings > Profile nav item can only be set up after 270 // the Settings component has run its own nav routine. 271 add_action( 'bp_settings_setup_nav', array( $this, 'setup_settings_nav' ) ); 272 273 parent::setup_nav( $main_nav, $sub_nav ); 254 'name' => _x( 'Edit','Profile header sub menu', 'buddypress' ), 255 'slug' => 'edit', 256 'parent_slug' => $slug, 257 'screen_function' => 'xprofile_screen_edit_profile', 258 'position' => 20, 259 'user_has_access' => false, 260 'user_has_access_callback' => 'bp_core_can_edit_settings', 261 ); 262 263 parent::register_nav( $main_nav, $sub_nav ); 274 264 } 275 265 … … 281 271 * 282 272 * @since 2.1.0 273 * @deprecated 12.0.0 283 274 */ 284 275 public function setup_settings_nav() { 285 if ( ! bp_is_active( 'settings' ) ) { 286 return; 287 } 288 289 // Stop if there is no user displayed or logged in. 290 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 291 return; 292 } 293 294 // Get the settings slug. 295 $settings_slug = bp_get_settings_slug(); 296 297 bp_core_new_subnav_item( array( 298 'name' => _x( 'Profile Visibility', 'Profile settings sub nav', 'buddypress' ), 299 'slug' => 'profile', 300 'parent_slug' => $settings_slug, 301 'screen_function' => 'bp_xprofile_screen_settings', 302 'position' => 30, 303 'user_has_access' => bp_core_can_edit_settings(), 304 ), 'members' ); 276 _deprecated_function( __METHOD__, '12.0.0' ); 305 277 } 306 278
Note: See TracChangeset
for help on using the changeset viewer.