Changeset 6901
- Timestamp:
- 02/26/2019 04:28:04 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/classes/class-bbp-admin.php
r6897 r6901 400 400 global $menu; 401 401 402 // Skip if no menu (AJAX, shortinit, etc...) 403 if ( empty( $menu ) ) { 404 return; 405 } 406 407 // Loop through menus, and maybe add the upgrade count 402 408 foreach ( $menu as $menu_index => $menu_item ) { 403 409 $found = array_search( 'tools.php', $menu_item, true ); … … 417 423 public function admin_menus() { 418 424 425 // Default hooks array 419 426 $hooks = array(); 420 427 … … 423 430 424 431 // Loop through tools and check 425 foreach ( $tools as $tool ) { 426 427 // Try to add the admin page 428 $page = add_management_page( 429 $tool['name'], 430 $tool['name'], 431 $tool['cap'], 432 $tool['page'], 433 $tool['func'] 434 ); 435 436 // Add page to hook if user can view it 437 if ( false !== $page ) { 438 $hooks[] = $page; 432 if ( ! empty( $tools ) ) { 433 foreach ( $tools as $tool ) { 434 435 // Try to add the admin page 436 $page = add_management_page( 437 $tool['name'], 438 $tool['name'], 439 $tool['cap'], 440 $tool['page'], 441 $tool['func'] 442 ); 443 444 // Add page to hook if user can view it 445 if ( false !== $page ) { 446 $hooks[] = $page; 447 } 439 448 } 440 } 441 442 // Fudge the highlighted subnav item when on a bbPress admin page 443 foreach ( $hooks as $hook ) { 444 add_action( "admin_head-{$hook}", 'bbp_tools_modify_menu_highlight' ); 449 450 // Fudge the highlighted subnav item when on a bbPress admin page 451 if ( ! empty( $hooks ) ) { 452 foreach ( $hooks as $hook ) { 453 add_action( "admin_head-{$hook}", 'bbp_tools_modify_menu_highlight' ); 454 } 455 } 445 456 } 446 457
Note: See TracChangeset
for help on using the changeset viewer.