monsterinsights_update_license_key

Helper method for updating the license key.

Description

(boolean) monsterinsights_update_license_key( (constant) $license_key = false, (constant) $network = false, (bool) $override = false ); 

Returns (boolean)

True if updated, false if not.

Parameters (3)

0. $license_key — Optional. (constant) => false
The license key.
1. $network — Optional. (constant) => false
The value to set for the key.
2. $override — Optional. (bool) => false
The override.

Usage

  1. if ( !function_exists( 'monsterinsights_update_license_key' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/options.php'; 
  3.  
  4. // The license key. 
  5. $license_key = false; 
  6.  
  7. // The value to set for the key. 
  8. $network = false; 
  9.  
  10. // The override. 
  11. $override = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = monsterinsights_update_license_key($license_key, $network, $override); 
  15.  

Defined (1)

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

/includes/options.php  
  1. function monsterinsights_update_license_key( $license_key = false, $network = false, $override = false ) { 
  2. if ( ! $license_key || ! is_string( $license_key ) || ! strlen( $license_key ) > 10 ) { 
  3. return false; 
  4.  
  5. if ( $network && is_multisite() && ( is_network_admin() || $override ) ) { 
  6. update_site_option( monsterinsights_license, $license_key ); 
  7. return true; 
  8. } else { 
  9. update_option( monsterinsights_license, $license_key ); 
  10. return true;