pmpro_admin_bar_menu

Admin Bar.

Description

pmpro_admin_bar_menu(); 

Usage

  1. if ( !function_exists( 'pmpro_admin_bar_menu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/adminpages.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_admin_bar_menu(); 
  7.  

Defined (1)

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

/includes/adminpages.php  
  1. function pmpro_admin_bar_menu() { 
  2. global $wp_admin_bar; 
  3.  
  4. //view menu at all? 
  5. if ( !current_user_can('pmpro_memberships_menu') || !is_admin_bar_showing() ) 
  6. return; 
  7.  
  8. //array of all caps in the menu 
  9. $pmpro_caps = pmpro_getPMProCaps(); 
  10.  
  11. //the top level menu links to the first page they have access to 
  12. foreach($pmpro_caps as $cap) 
  13. if(current_user_can($cap)) 
  14. $top_menu_page = str_replace("_", "-", $cap); 
  15. break; 
  16. }  
  17.  
  18. $wp_admin_bar->add_menu( array( 
  19. 'id' => 'paid-memberships-pro',  
  20. 'title' => __( '<span class="ab-icon"></span>Memberships', 'paid-memberships-pro' ),  
  21. 'href' => get_admin_url(NULL, '/admin.php?page=' . $top_menu_page) ) ); 
  22.  
  23. if(current_user_can('pmpro_membershiplevels')) 
  24. $wp_admin_bar->add_menu( array( 
  25. 'id' => 'pmpro-membership-levels',  
  26. 'parent' => 'paid-memberships-pro',  
  27. 'title' => __( 'Membership Levels', 'paid-memberships-pro' ),  
  28. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-membershiplevels') ) ); 
  29.  
  30. if(current_user_can('pmpro_pagesettings')) 
  31. $wp_admin_bar->add_menu( array( 
  32. 'id' => 'pmpro-page-settings',  
  33. 'parent' => 'paid-memberships-pro',  
  34. 'title' => __( 'Page Settings', 'paid-memberships-pro' ),  
  35. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-pagesettings') ) ); 
  36.  
  37. if(current_user_can('pmpro_paymentsettings'))  
  38. $wp_admin_bar->add_menu( array( 
  39. 'id' => 'pmpro-payment-settings',  
  40. 'parent' => 'paid-memberships-pro',  
  41. 'title' => __( 'Payment Settings', 'paid-memberships-pro' ),  
  42. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-paymentsettings') ) ); 
  43.  
  44. if(current_user_can('pmpro_emailsettings'))  
  45. $wp_admin_bar->add_menu( array( 
  46. 'id' => 'pmpro-email-settings',  
  47. 'parent' => 'paid-memberships-pro',  
  48. 'title' => __( 'Email Settings', 'paid-memberships-pro' ),  
  49. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-emailsettings') ) ); 
  50.  
  51. if(current_user_can('pmpro_advancedsettings'))  
  52. $wp_admin_bar->add_menu( array( 
  53. 'id' => 'pmpro-advanced-settings',  
  54. 'parent' => 'paid-memberships-pro',  
  55. 'title' => __( 'Advanced Settings', 'paid-memberships-pro' ),  
  56. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-advancedsettings') ) ); 
  57.  
  58. if(current_user_can('pmpro_addons'))  
  59. $wp_admin_bar->add_menu( array( 
  60. 'id' => 'pmpro-addons',  
  61. 'parent' => 'paid-memberships-pro',  
  62. 'title' => __( 'Add Ons', 'paid-memberships-pro' ),  
  63. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-addons') ) );  
  64.  
  65. if(current_user_can('pmpro_memberslist'))  
  66. $wp_admin_bar->add_menu( array( 
  67. 'id' => 'pmpro-members-list',  
  68. 'parent' => 'paid-memberships-pro',  
  69. 'title' => __( 'Members List', 'paid-memberships-pro' ),  
  70. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-memberslist') ) ); 
  71.  
  72. if(current_user_can('pmpro_reports'))  
  73. $wp_admin_bar->add_menu( array( 
  74. 'id' => 'pmpro-reports',  
  75. 'parent' => 'paid-memberships-pro',  
  76. 'title' => __( 'Reports', 'paid-memberships-pro' ),  
  77. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-reports') ) ); 
  78.  
  79. if(current_user_can('pmpro_orders'))  
  80. $wp_admin_bar->add_menu( array( 
  81. 'id' => 'pmpro-orders',  
  82. 'parent' => 'paid-memberships-pro',  
  83. 'title' => __( 'Orders', 'paid-memberships-pro' ),  
  84. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-orders') ) ); 
  85.  
  86. if(current_user_can('pmpro_discountcodes'))  
  87. $wp_admin_bar->add_menu( array( 
  88. 'id' => 'pmpro-discount-codes',  
  89. 'parent' => 'paid-memberships-pro',  
  90. 'title' => __( 'Discount Codes', 'paid-memberships-pro' ),  
  91. 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-discountcodes') ) );