Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Extension_License::deactivate_license()

Deactivate the license key


Description Description


Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Return Return

(void)


Top ↑

Source Source

File: classes/Extension/License.php

	public function deactivate_license() {

		if ( ! isset( $_POST['pum_settings'] ) ) {
			return;
		}

		if ( ! isset( $_POST['pum_settings'][ $this->item_shortname . '_license_key' ] ) ) {
			return;
		}

		if ( ! current_user_can( 'manage_options' ) ) {
			return;
		}

		// Run on deactivate button press
		if ( isset( $_POST['pum_license_deactivate'][ $this->item_shortname . '_license_key' ] ) ) {

			// Data to send to the API
			$api_params = array(
				'edd_action' => 'deactivate_license',
				'license'    => $this->license,
				'item_name'  => urlencode( $this->item_name ),
				'url'        => home_url(),
			);

			// Call the API
			$response = wp_remote_post( $this->api_url, array(
				'timeout'   => 15,
				'sslverify' => false,
				'body'      => $api_params,
			) );

			// Make sure there are no errors
			if ( is_wp_error( $response ) ) {
				return;
			}

			// Decode the license data
			$license_data = json_decode( wp_remote_retrieve_body( $response ) );

			delete_option( $this->item_shortname . '_license_active' );

		}
	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.