bb_admin_menu_generator

Menu.

Description

bb_admin_menu_generator(); 

Usage

  1. if ( !function_exists( 'bb_admin_menu_generator' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bb_admin_menu_generator(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php  
  1. function bb_admin_menu_generator() 
  2. global $bb_menu, $bb_submenu; 
  3. $bb_menu = array(); 
  4. $bb_submenu = array(); 
  5.  
  6. // Dashboard menu items < 50 
  7. $bb_menu[0] = array( __( 'Dashboard' ), 'moderate', 'index.php', '', 'bb-menu-dashboard' ); 
  8. $bb_submenu['index.php'][5] = array( __( 'Dashboard' ), 'moderate', 'index.php' ); 
  9.  
  10. // 50 < Plugin added menu items < 100 
  11.  
  12. $bb_menu[100] = array( '', 'read', 'separator' ); 
  13.  
  14. // 100 < Plugin added menu items < 150 
  15.  
  16. // 150 < First menu items < 200 
  17. $bb_menu[150] = array( __( 'Forums' ), 'manage_forums', 'forums.php', '', 'bb-menu-forums' ); 
  18. $bb_submenu['forums.php'][5] = array( __( 'Forums' ), 'manage_forums', 'forums.php' ); 
  19. $bb_menu[155] = array( __( 'Topics' ), 'moderate', 'topics.php', '', 'bb-menu-topics' ); 
  20. $bb_submenu['topics.php'][5] = array( __( 'Topics' ), 'moderate', 'topics.php' ); 
  21. $bb_menu[160] = array( __( 'Posts' ), 'moderate', 'posts.php', '', 'bb-menu-posts' ); 
  22. $bb_submenu['posts.php'][5] = array( __( 'Posts' ), 'moderate', 'posts.php' ); 
  23.  
  24. // 200 < Plugin added menu items < 250 
  25.  
  26. $bb_menu[250] = array( '', 'read', 'separator' ); 
  27.  
  28. // 250 < Plugin added menu items < 300 
  29.  
  30. // 300 < Second menu items < 350 
  31. $bb_menu[300] = array( __( 'Appearance' ), 'manage_themes', 'themes.php', '', 'bb-menu-appearance' ); 
  32. $bb_submenu['themes.php'][5] = array(__('Themes'), 'manage_themes', 'themes.php'); 
  33. $bb_menu[305] = array( __( 'Plugins' ), 'use_keys', 'plugins.php', '', 'bb-menu-plugins' ); 
  34. $bb_submenu['plugins.php'][5] = array( __( 'Installed' ), 'manage_plugins', 'plugins.php' ); 
  35. $bb_menu[310] = array( __( 'Users' ), 'moderate', 'users.php', '', 'bb-menu-users' ); 
  36. $bb_submenu['users.php'][5] = array( __( 'Users' ), 'moderate', 'users.php' ); 
  37. $bb_submenu['users.php'][10] = array( __( 'Add New' ), 'manage_options', 'user-add-new.php' ); 
  38. $bb_menu[315] = array( __( 'Tools' ), 'recount', 'tools-recount.php', '', 'bb-menu-tools' ); 
  39. $bb_submenu['tools-recount.php'][5] = array( __( 'Re-count' ), 'recount', 'tools-recount.php' ); 
  40. $bb_menu[320] = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'bb-menu-settings' ); 
  41. $bb_submenu['options-general.php'][5] = array( __( 'General' ), 'manage_options', 'options-general.php' ); 
  42. //$bb_submenu['options-general.php'][10] = array( __( 'Date and Time' ), 'manage_options', 'options-time.php' ); 
  43. $bb_submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' ); 
  44. $bb_submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' ); 
  45. $bb_submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' ); 
  46. $bb_submenu['options-general.php'][30] = array( __( 'Permalinks' ), 'manage_options', 'options-permalinks.php' ); 
  47. $bb_submenu['options-general.php'][35] = array( __( 'WordPress Integration' ), 'manage_options', 'options-wordpress.php' ); 
  48.  
  49. // 350 < Plugin added menu items 
  50.  
  51. ksort( $bb_menu ); 
  52.  
  53. $last_key = false; 
  54. foreach ( $bb_menu as $key => $m ) { 
  55. if ( $last_key === false || $bb_menu[$last_key][2] === 'separator' ) { 
  56. $bb_menu[$key][3] .= ' bb-menu-first'; 
  57. if ( $bb_menu[$key][2] === 'separator' ) { 
  58. $bb_menu[$last_key][3] .= ' bb-menu-last'; 
  59. $last_key = $key; 
  60. if ( isset( $bb_submenu[$m[2]] ) ) { 
  61. ksort( $bb_submenu[$m[2]] ); 
  62. $bb_menu[$last_key][3] .= ' bb-menu-last';