Way too deactivate all domains under a key
-
it would be great to have a way to deactivate all domains under a specific key either through the API (slm_deactivate) or through the interface above the registered domain. for the cases where you have multiple domains and you don’t want to remove them one by one
something like this for the API (note that the code could be completely off my understanding of PHP is limited)
global $wpdb; $registered_dom_table = SLM_TBL_LIC_DOMAIN; if ($registered_domain === “all”) { $sql_prep = $wpdb->prepare(“DELETE FROM $registered_dom_table WHERE lic_key=%s”, $license_key); } else { $sql_prep = $wpdb->prepare(“DELETE FROM $registered_dom_table WHERE lic_key=%s AND registered_domain=%s”, $license_key, $registered_domain); } $delete = $wpdb->query($sql_prep); if ($delete === false) { $slm_debug_logger->log_debug(‘Error – failed to delete the registered domain from the database.’); } elseif ($delete == 0) { $args = (array( ‘result’ => ‘error’, ‘message’ => ‘The license key on this domain is already inactive’, ‘error_code’ => SLM_Error_Codes::DOMAIN_ALREADY_INACTIVE, )); SLM_API_Utility::output_api_response($args); } else { $args = (array( ‘result’ => ‘success’, ‘message’ => ‘The license key has been deactivated for this domain’, )); SLM_API_Utility::output_api_response($args); }
- The topic ‘Way too deactivate all domains under a key’ is closed to new replies.