monsterinsights_network_settings_save_general

Callback for saving the general settings tab.

Description

monsterinsights_network_settings_save_general(); 

Usage

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

Defined (1)

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

/includes/admin/pages/network-settings.php  
  1. function monsterinsights_network_settings_save_general() { 
  2.  
  3. // Check if user pressed the 'Update' button and nonce is valid 
  4. if ( ! isset( $_POST['monsterinsights-network-settings-submit'] ) ) { 
  5. return; 
  6.  
  7. if ( ! wp_verify_nonce( $_POST['monsterinsights-network-settings-nonce'], 'monsterinsights-network-settings-nonce' ) ) { 
  8. return; 
  9.  
  10. if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { 
  11. return; 
  12.  
  13. $throw_notice = false; 
  14. $network_manual_ua_code = isset( $_POST['network_manual_ua_code'] ) ? $_POST['network_manual_ua_code'] : ''; 
  15. $network_manual_ua_code = monsterinsights_is_valid_ua( $network_manual_ua_code ); // also sanitizes the string 
  16.  
  17. if ( $network_manual_ua_code ) { 
  18. update_site_option( 'monsterinsights_network_manual_ua_code', $network_manual_ua_code ); 
  19. } else { 
  20. if ( empty ( $network_manual_ua_code ) && isset( $_POST['network_manual_ua_code'] ) ) { 
  21. $throw_notice = true; 
  22. update_site_option( 'monsterinsights_network_manual_ua_code', '' ); 
  23.  
  24. // Output an admin notice so the user knows what happened 
  25. if ( $throw_notice ) { 
  26. } else {