monsterinsights_lite_uninstall_hook

Fired when the plugin is uninstalled.

Description

monsterinsights_lite_uninstall_hook( $network_wide ); 

Parameters (1)

0. $network_wide
The network wide.

Usage

  1. if ( !function_exists( 'monsterinsights_lite_uninstall_hook' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/googleanalytics.php'; 
  3.  
  4. // The network wide. 
  5. $network_wide = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = monsterinsights_lite_uninstall_hook($network_wide); 
  9.  

Defined (1)

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

/googleanalytics.php  
  1. function monsterinsights_lite_uninstall_hook( $network_wide ) { 
  2. wp_cache_flush(); 
  3. $instance = MonsterInsights(); 
  4. // Note, if both MI Pro and Lite are active, this is an MI Pro instance 
  5. // Therefore MI Lite can only use functions of the instance common to 
  6. // both plugins. If it needs to be pro specific, then include a file that 
  7. // has that method. 
  8. if ( is_multisite() && $network_wide ) { 
  9. delete_site_option( monsterinsights_license ); 
  10. delete_site_option( 'monsterinsights_license_updates' ); 
  11. $site_list = get_sites(); 
  12.  
  13. $options = array( 
  14. 'analytics_profile_code',  
  15. 'analytics_profile',  
  16. 'analytics_profile_name',  
  17. 'analytics_name',  
  18. 'oauth_version',  
  19. 'cron_failed',  
  20. 'cron_last_run',  
  21. ); 
  22.  
  23. foreach ( (array) $site_list as $site ) { 
  24. switch_to_blog( $site->blog_id ); 
  25. delete_option( monsterinsights_license ); 
  26. delete_option( 'monsterinsights_license_updates' ); 
  27.  
  28. delete_option( 'monsterinsights_lite_access_token' ); 
  29. delete_option( 'monsterinsights_lite_refresh_token' ); 
  30.  
  31. // Destroy the data 
  32. $instance->reports->delete_aggregate_data();  
  33. restore_current_blog(); 
  34. } else { 
  35. delete_option( monsterinsights_license ); 
  36. delete_option( 'monsterinsights_license_updates' ); 
  37.  
  38. $options = array( 
  39. 'analytics_profile_code',  
  40. 'analytics_profile',  
  41. 'analytics_profile_name',  
  42. 'analytics_name',  
  43. 'oauth_version',  
  44. 'cron_failed',  
  45. 'cron_last_run',  
  46. ); 
  47. delete_option( 'monsterinsights_lite_access_token' ); 
  48. delete_option( 'monsterinsights_lite_refresh_token' ); 
  49.  
  50. // Destroy the data 
  51. if ( isset( $instance->reports ) && method_exists( $instance->reports, 'delete_aggregate_data' ) ) { 
  52. $instance->reports->delete_aggregate_data(); 
  53.