pmpro_add_pages

Dashboard Menu.

Description

pmpro_add_pages(); 

Usage

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

Defined (1)

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

/includes/adminpages.php  
  1. function pmpro_add_pages() 
  2. global $wpdb;  
  3.  
  4. //array of all caps in the menu 
  5. $pmpro_caps = pmpro_getPMProCaps(); 
  6.  
  7. //the top level menu links to the first page they have access to 
  8. foreach($pmpro_caps as $cap) 
  9. if(current_user_can($cap)) 
  10. $top_menu_cap = $cap; 
  11. break; 
  12.  
  13. if(empty($top_menu_cap)) 
  14. return; 
  15.  
  16. add_menu_page(__('Memberships', 'paid-memberships-pro' ), __('Memberships', 'paid-memberships-pro' ), 'pmpro_memberships_menu', 'pmpro-membershiplevels', $top_menu_cap, 'dashicons-groups'); 
  17. add_submenu_page('pmpro-membershiplevels', __('Page Settings', 'paid-memberships-pro' ), __('Page Settings', 'paid-memberships-pro' ), 'pmpro_pagesettings', 'pmpro-pagesettings', 'pmpro_pagesettings'); 
  18. add_submenu_page('pmpro-membershiplevels', __('Payment Settings', 'paid-memberships-pro' ), __('Payment Settings', 'paid-memberships-pro' ), 'pmpro_paymentsettings', 'pmpro-paymentsettings', 'pmpro_paymentsettings'); 
  19. add_submenu_page('pmpro-membershiplevels', __('Email Settings', 'paid-memberships-pro' ), __('Email Settings', 'paid-memberships-pro' ), 'pmpro_emailsettings', 'pmpro-emailsettings', 'pmpro_emailsettings'); 
  20. add_submenu_page('pmpro-membershiplevels', __('Advanced Settings', 'paid-memberships-pro' ), __('Advanced Settings', 'paid-memberships-pro' ), 'pmpro_advancedsettings', 'pmpro-advancedsettings', 'pmpro_advancedsettings'); 
  21. add_submenu_page('pmpro-membershiplevels', __('Add Ons', 'paid-memberships-pro' ), __('Add Ons', 'paid-memberships-pro' ), 'pmpro_addons', 'pmpro-addons', 'pmpro_addons'); 
  22. add_submenu_page('pmpro-membershiplevels', __('Members List', 'paid-memberships-pro' ), __('Members List', 'paid-memberships-pro' ), 'pmpro_memberslist', 'pmpro-memberslist', 'pmpro_memberslist'); 
  23. add_submenu_page('pmpro-membershiplevels', __('Reports', 'paid-memberships-pro' ), __('Reports', 'paid-memberships-pro' ), 'pmpro_reports', 'pmpro-reports', 'pmpro_reports'); 
  24. add_submenu_page('pmpro-membershiplevels', __('Orders', 'paid-memberships-pro' ), __('Orders', 'paid-memberships-pro' ), 'pmpro_orders', 'pmpro-orders', 'pmpro_orders'); 
  25. add_submenu_page('pmpro-membershiplevels', __('Discount Codes', 'paid-memberships-pro' ), __('Discount Codes', 'paid-memberships-pro' ), 'pmpro_discountcodes', 'pmpro-discountcodes', 'pmpro_discountcodes'); 
  26.  
  27. //updates page only if needed 
  28. if(pmpro_isUpdateRequired()) 
  29. add_submenu_page('pmpro-membershiplevels', __('Updates Required', 'paid-memberships-pro' ), __('Updates Required', 'paid-memberships-pro' ), 'pmpro_updates', 'pmpro-updates', 'pmpro_updates');  
  30.  
  31. //rename the automatically added Memberships submenu item 
  32. global $submenu; 
  33. if(!empty($submenu['pmpro-membershiplevels'])) 
  34. if(current_user_can("pmpro_membershiplevels")) 
  35. $submenu['pmpro-membershiplevels'][0][0] = __( 'Membership Levels', 'paid-memberships-pro' ); 
  36. $submenu['pmpro-membershiplevels'][0][3] = __( 'Membership Levels', 'paid-memberships-pro' ); 
  37. elseif(current_user_can($top_menu_cap)) 
  38. unset($submenu['pmpro-membershiplevels'][0]); 
  39. else 
  40. unset($submenu['pmpro-membershiplevels']);