<?php // Important: Check if the file is the one // that was registered during the uninstall hook. if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } if (!current_user_can('activate_plugins')) { exit; } check_admin_referer('bulk-plugins'); global $wpdb; // UNAPPLYING ALL THE MOLDS $mold = new WC_Molds(); $molds = $wpdb->get_results('SELECT meta_id FROM ' . $wpdb->prefix . 'postmeta WHERE meta_key = "_mold"'); foreach ($molds as $mold) { $mold->pm_load_from_db($mold->meta_id); $mold->pm_unapply_mold(); } // DELETING ALL THE MOLDS $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'postmeta WHERE meta_key = "_mold"');
} } ?> <input id="save" name="save" type="hidden" value="no"> <input id="reset" name="reset" type="hidden" value="no"> <input id="remove" name="remove" type="hidden" value="no"> <button type="submit" onclick="document.getElementById('save').value='yes';" class="button button-primary button-large"><?php _e('Save', 'woocommerce-molds'); ?> </button> <?php if ($_POST['action'] == 'edit') { $applied = $mold->pm_get_applied(); if ($applied == "yes") { $mold->pm_unapply_mold(); } } if ($_POST['action'] == 'new') { ?> <button type="submit" onclick="document.getElementById('reset').value='yes';" class="button button-primary button-large red"><?php _e('Reset', 'woocommerce-molds'); ?> </button> <?php } ## We handle the data passing through submitting ## // PRODUCT ID if (isset($_POST['product'])) { $mold->pm_set_product_id($_POST['product']); }