Example #1
0
 /**
  * When the settings are saved, make sure the license key matches the previously activated key
  *
  * @return array settings from parent::get_posted_settings(), with `license_key_response` and `license_key_status` potentially unset
  */
 public function get_posted_settings()
 {
     $posted_settings = parent::get_posted_settings();
     // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
     // then we assume it's changed. If it's changed, unset the status and the previous response.
     if (isset($posted_settings['license_key']) && isset($posted_settings['license_key_response']['license_key']) && $posted_settings['license_key'] !== $posted_settings['license_key_response']['license_key']) {
         unset($posted_settings['license_key_response']);
         unset($posted_settings['license_key_status']);
         GFCommon::add_error_message(__('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview'));
     }
     return $posted_settings;
 }