monsterinsights_dashboard_page

Callback to output the MonsterInsights reports page.

Description

monsterinsights_dashboard_page(); 

Usage

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

Defined (1)

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

/includes/admin/pages/dashboard.php  
  1. function monsterinsights_dashboard_page() { 
  2. /**  
  3. * Developer Alert: 
  4. * Per the README, this is considered an internal hook and should 
  5. * not be used by other developers. This hook's behavior may be modified 
  6. * or the hook may be removed at any time, without warning. 
  7. */ 
  8. do_action( 'monsterinsights_head' ); 
  9.  
  10. if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { 
  11. wp_die( esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) ); 
  12.  
  13. $dashboard_disabled = monsterinsights_get_option( 'dashboard_disabled', false ); 
  14. $profile_enabled = monsterinsights_get_option( 'analytics_profile', false ); // not using profile 
  15. $oauth_version = monsterinsights_get_option( 'oauth_version', '1.0' ); 
  16. $last_run = monsterinsights_get_option( 'cron_last_run', false ); 
  17. $failed = monsterinsights_get_option( 'cron_failed', false ); 
  18. $pro_access_key = get_option( 'monsterinsights_pro_access_token', false ); 
  19. $lite_access_key = get_option( 'monsterinsights_lite_access_token', false ); 
  20. $needs_re_auth = ( ( $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) || ( empty( $pro_access_key ) && empty( $lite_access_key ) ) || ( version_compare( $oauth_version, '1.0', '<' ) ) ) ? true : false; 
  21. ?> 
  22. <?php echo monsterinsights_ublock_notice(); ?> 
  23. <div id="monsterinsights-reports" class="wrap"> 
  24. <div class="monsterinsights-clear"> 
  25. <div class="monsterinsights-reports-action-bar"> 
  26. <div class="monsterinsights-reports-action-bar-title"> 
  27. <?php esc_html_e( 'Dashboard', 'google-analytics-for-wordpress' );?> 
  28. </div> 
  29. <div class="monsterinsights-reports-action-bar-actions"><?php  
  30. /**  
  31. * Developer Alert: 
  32. * Per the README, this is considered an internal hook and should 
  33. * not be used by other developers. This hook's behavior may be modified 
  34. * or the hook may be removed at any time, without warning. 
  35. */ 
  36. ?>  
  37. </div> 
  38. </div> 
  39. <?php  
  40. ?> 
  41. <div id="monsterinsights_dashboard_container"> 
  42. <?php if ( $dashboard_disabled ) { ?> 
  43. <?php  
  44. if ( current_user_can( 'monsterinsights_save_settings' ) ) { 
  45. echo monsterinsights_get_message( error, sprintf( 
  46. sprintf( 
  47. esc_html__( 'Please %1$senable the dashboard%2$s to see report data.', 'google-analytics-for-wordpress' ),  
  48. '<a href="' . admin_url( 'admin.php?page=monsterinsights_settings' ) . '">',  
  49. '</a>' 
  50. ) ); 
  51. } else { 
  52. echo monsterinsights_get_message( error, esc_html__( 'The Google oAuth authentication needs to be re-authenticated to view data.', 'google-analytics-for-wordpress' ) ); 
  53. ?> 
  54. <?php } else if ( ! $profile_enabled ) { ?> 
  55. <?php  
  56. if ( current_user_can( 'monsterinsights_save_settings' ) ) { 
  57. echo monsterinsights_get_message( error, sprintf( 
  58. sprintf( 
  59. esc_html__( 'Please %1$sauthenticate %2$swith Google Analytics to allow the plugin to fetch data.', 'google-analytics-for-wordpress' ),  
  60. '<a href="' . admin_url( 'admin.php?page=monsterinsights_settings' ) . '">',  
  61. '</a>' 
  62. ) ); 
  63. } else { 
  64. echo monsterinsights_get_message( error, esc_html__( 'The Google oAuth authentication needs to be re-authenticated to view data.', 'google-analytics-for-wordpress' ) ); 
  65. ?> 
  66. <?php } else if ( $needs_re_auth ) { ?> 
  67. <?php  
  68. if ( current_user_can( 'monsterinsights_save_settings' ) ) { 
  69. echo monsterinsights_get_message( error, sprintf( 
  70. sprintf( 
  71. esc_html__( 'Please %1$sre-authenticate%2$s with Google Analytics to allow the plugin to fetch data.', 'google-analytics-for-wordpress' ),  
  72. '<a href="' . admin_url( 'admin.php?page=monsterinsights_settings' ) . '">',  
  73. '</a>' 
  74. ) ); 
  75. } else { 
  76. echo monsterinsights_get_message( error, esc_html__( 'The Google oAuth authentication needs to be re-authenticated to view data.', 'google-analytics-for-wordpress' ) ); 
  77. ?> 
  78. <?php } else if ( $failed ) { ?> 
  79. <?php  
  80. if ( current_user_can( 'monsterinsights_save_settings' ) ) { 
  81. echo monsterinsights_get_message( error, sprintf( 
  82. sprintf( 
  83. esc_html__( 'Data is not up-to-date, there was anerrorin retrieving the data from Google Analytics. Thiserrorcould be caused by several issues. If theerrorpersists, please see %1$sthis page%2$s.', 'google-analytics-for-wordpress' ),  
  84. '<a href="https://www.monsterinsights.com/docs/blocked-connection/">',  
  85. '</a>' 
  86. ) ); 
  87. } else { 
  88. echo monsterinsights_get_message( error, esc_html__( 'The Google oAuth authentication needs to be re-authenticated to view data.', 'google-analytics-for-wordpress' ) ); 
  89. ?> 
  90. <?php } else { ?> 
  91. <div class="monsterinsights-reports-wrap"> 
  92. <?php 
  93. /**  
  94. * Developer Alert: 
  95. * Per the README, this is considered an internal hook and should 
  96. * not be used by other developers. This hook's behavior may be modified 
  97. * or the hook may be removed at any time, without warning. 
  98. */ 
  99. ?> 
  100. <?php do_action( 'monsterinsights_tab_reports_notices' ); ?> 
  101. <?php 
  102. /**  
  103. * Developer Alert: 
  104. * Per the README, this is considered an internal hook and should 
  105. * not be used by other developers. This hook's behavior may be modified 
  106. * or the hook may be removed at any time, without warning. 
  107. */ 
  108. ?> 
  109. </div> 
  110. <?php } ?> 
  111. </div> 
  112. </div> 
  113. </div> 
  114. <?php