monsterinsights_settings_save_general

Callback for saving the general settings tab.

Description

monsterinsights_settings_save_general(); 

Usage

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

Defined (1)

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

/includes/admin/settings/tab-general.php  
  1. function monsterinsights_settings_save_general() { 
  2. $throw_notice = false; 
  3. $manual_ua_code = isset( $_POST['manual_ua_code'] ) ? $_POST['manual_ua_code'] : ''; 
  4. $manual_ua_code = monsterinsights_is_valid_ua( $manual_ua_code ); // also sanitizes the string 
  5.  
  6. if ( $manual_ua_code ) { 
  7. monsterinsights_update_option( 'manual_ua_code', $manual_ua_code ); 
  8. } else { 
  9. if ( empty ( $manual_ua_code ) && isset( $_POST['manual_ua_code'] ) ) { 
  10. $throw_notice = true; 
  11. monsterinsights_update_option( 'manual_ua_code', '' ); 
  12.  
  13. $dashboards_disabled = isset( $_POST['dashboards_disabled'] ) ? 1 : 0; 
  14. monsterinsights_update_option( 'dashboards_disabled', $dashboards_disabled ); 
  15.  
  16. $old_tracking_mode = monsterinsights_get_option( 'tracking_mode', 'analytics' ); 
  17. $tracking_mode = isset( $_POST['tracking_mode'] ) ? $_POST['tracking_mode'] : 'analytics'; 
  18.  
  19. if ( $old_tracking_mode === 'ga' || monsterinsights_is_debug_mode() ) { 
  20. if ( $tracking_mode !== 'analytics' && $tracking_mode !== 'ga' ) { 
  21. /**  
  22. * Developer Alert: 
  23. * Per the README, this is considered an internal hook and should 
  24. * not be used by other developers. This hook's behavior may be modified 
  25. * or the hook may be removed at any time, without warning. 
  26. */ 
  27. $tracking_mode = apply_filters( 'monsterinsights_settings_save_general_tracking_mode', 'analytics' ); 
  28. monsterinsights_update_option( 'tracking_mode', $tracking_mode ); 
  29. } else { 
  30. if ( $tracking_mode !== 'analytics' ) { 
  31. /**  
  32. * Developer Alert: 
  33. * Per the README, this is considered an internal hook and should 
  34. * not be used by other developers. This hook's behavior may be modified 
  35. * or the hook may be removed at any time, without warning. 
  36. */ 
  37. $tracking_mode = apply_filters( 'monsterinsights_settings_save_general_tracking_mode', 'analytics' ); 
  38. monsterinsights_update_option( 'tracking_mode', $tracking_mode ); 
  39.  
  40. $anonymous_data = isset( $_POST['anonymous_data'] ) ? 1 : 0; 
  41. if ( $anonymous_data ) { 
  42. monsterinsights_update_option( 'anonymous_data', $anonymous_data ); 
  43.  
  44. /**  
  45. * Developer Alert: 
  46. * Per the README, this is considered an internal hook and should 
  47. * not be used by other developers. This hook's behavior may be modified 
  48. * or the hook may be removed at any time, without warning. 
  49. */ 
  50.  
  51. // Output an admin notice so the user knows what happened 
  52. if ( $throw_notice ) { 
  53. } else {