monsterinsights_admin_menu

Register menu items for MonsterInsights.

Description

monsterinsights_admin_menu(); 

Usage

  1. if ( !function_exists( 'monsterinsights_admin_menu' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/admin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = monsterinsights_admin_menu(); 
  7.  

Defined (1)

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

/includes/admin/admin.php  
  1. function monsterinsights_admin_menu() { 
  2.  
  3. // Get the base class object. 
  4. $base = MonsterInsights(); 
  5.  
  6. $dashboards_disabled = monsterinsights_get_option( 'dashboards_disabled', false ); 
  7.  
  8. $hook = 'monsterinsights_settings'; 
  9.  
  10. if ( $dashboards_disabled || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) { 
  11. // If dashboards disabled, first settings page 
  12. add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', plugins_url( 'assets/css/images/menu-icon@2x.png', $base->file ), '100.00013467543' ); 
  13. $hook = 'monsterinsights_settings'; 
  14.  
  15. add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' ); 
  16. } else { 
  17. // if dashboards enabled, first dashboard 
  18. add_menu_page( __( 'Dashboard:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_dashboard', 'monsterinsights_dashboard_page', plugins_url( 'assets/css/images/menu-icon@2x.png', $base->file ), '100.00013467543' ); 
  19.  
  20. $hook = 'monsterinsights_dashboard'; 
  21.  
  22. add_submenu_page( $hook, __( 'Dashboard:', 'google-analytics-for-wordpress' ), __( 'Dashboard', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_dashboard' ); 
  23.  
  24. // then settings page 
  25. add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' ); 
  26.  
  27. if ( ! $dashboards_disabled ) { 
  28. // then reports 
  29. add_submenu_page( $hook, __( 'Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' ); 
  30.  
  31. // then tools 
  32. add_submenu_page( $hook, __( 'Tools:', 'google-analytics-for-wordpress' ), __( 'Tools', 'google-analytics-for-wordpress' ), 'manage_options', 'monsterinsights_tools', 'monsterinsights_tools_page' ); 
  33.  
  34. // then addons 
  35. $network_license = get_site_option( monsterinsights_license ); 
  36. if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_license ) ) ) { 
  37. add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:#7cc048"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', 'monsterinsights_addons', 'monsterinsights_addons_page' );