Changeset 10538
- Timestamp:
- 02/06/2016 06:07:22 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-admin.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-admin.php
r10537 r10538 146 146 147 147 // Add menu item to settings menu. 148 add_action( 'admin_menu', array( $this, 'site_admin_menus' ), 5 ); 148 149 add_action( bp_core_admin_hook(), array( $this, 'admin_menus' ), 5 ); 149 150 … … 186 187 187 188 /** 188 * Add the navigational menu elements. 189 * Register site- or network-admin nav menu elements. 190 * 191 * Contextually hooked to site or network-admin depending on current configuration. 189 192 * 190 193 * @since 1.6.0 … … 304 307 ); 305 308 306 $hooks[] = add_theme_page( 307 _x( 'Emails', 'screen heading', 'buddypress' ), 308 _x( 'Emails', 'screen heading', 'buddypress' ), 309 $this->capability, 310 'bp-emails-customizer-redirect', 311 'bp_email_redirect_to_customizer' 312 ); 309 // For network-wide configs, add a link to (the root site's) Emails screen. 310 if ( is_network_admin() && bp_is_network_activated() ) { 311 $email_labels = bp_get_email_post_type_labels(); 312 $email_url = get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() ); 313 314 $hooks[] = add_menu_page( 315 $email_labels['name'], 316 $email_labels['name'], 317 $this->capability, 318 '', 319 '', 320 'dashicons-email', 321 26 322 ); 323 324 // Hack: change the link to point to the root site's admin, not the network admin. 325 $GLOBALS['menu'][26][2] = esc_url_raw( $email_url ); 326 } 327 328 foreach( $hooks as $hook ) { 329 add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' ); 330 } 331 } 332 333 /** 334 * Register site-admin nav menu elements. 335 * 336 * @since 2.5.0 337 */ 338 public function site_admin_menus() { 339 if ( ! bp_current_user_can( 'manage_options' ) ) { 340 return; 341 } 342 343 $hooks = array(); 344 345 if ( bp_is_root_blog() ) { 346 // Appearance > Emails. 347 $hooks[] = add_theme_page( 348 _x( 'Emails', 'screen heading', 'buddypress' ), 349 _x( 'Emails', 'screen heading', 'buddypress' ), 350 $this->capability, 351 'bp-emails-customizer-redirect', 352 'bp_email_redirect_to_customizer' 353 ); 354 } 313 355 314 356 foreach( $hooks as $hook ) { … … 906 948 public function emails_admin_menu_order( $custom_menus = array() ) { 907 949 array_push( $custom_menus, 'edit.php?post_type=' . bp_get_email_post_type() ); 950 951 if ( is_network_admin() && bp_is_network_activated() ) { 952 array_push( 953 $custom_menus, 954 get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() ) 955 ); 956 } 957 908 958 return $custom_menus; 909 959 }
Note: See TracChangeset
for help on using the changeset viewer.