parent
56714e1d62
commit
90ba359ef9
|
@ -1,6 +1,6 @@
|
|||
<form method="post" action="options.php">
|
||||
<?php settings_fields( 'woocommerce_status_settings_fields' ); ?>
|
||||
<?php $options = get_option( 'woocommerce_status_options' ); ?>
|
||||
<?php $options = wp_parse_args( get_option( 'woocommerce_status_options', array() ), array( 'uninstall_data' => 0, 'template_debug_mode' => 0 ) ); ?>
|
||||
<table class="wc_status_table widefat" cellspacing="0">
|
||||
<thead class="tools">
|
||||
<tr>
|
||||
|
@ -23,13 +23,24 @@
|
|||
<td><?php _e( 'Template Debug Mode', 'woocommerce' ); ?></td>
|
||||
<td>
|
||||
<p>
|
||||
<label><input type="checkbox" class="checkbox" name="woocommerce_status_options" value="1" <?php checked('1', $options); ?> /> <?php _e( 'Enabled', 'woocommerce' ); ?></label>
|
||||
<label><input type="checkbox" class="checkbox" name="woocommerce_status_options[template_debug_mode]" value="1" <?php checked( '1', $options['template_debug_mode'] ); ?> /> <?php _e( 'Enabled', 'woocommerce' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<span class="description"><?php _e( 'This tool will disable template overrides for logged-in administrators for debugging purposes.', 'woocommerce' ); ?></span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php _e( 'Remove post types on uninstall', 'woocommerce' ); ?></td>
|
||||
<td>
|
||||
<p>
|
||||
<label><input type="checkbox" class="checkbox" name="woocommerce_status_options[uninstall_data]" value="1" <?php checked( '1', $options['uninstall_data'] ); ?> /> <?php _e( 'Enabled', 'woocommerce' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<span class="description"><?php _e( 'This tool will delete all product and order post data when uninstalling via Plugins > Delete.', 'woocommerce' ); ?></span>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
|
|
|
@ -63,7 +63,8 @@ class WC_Template_Loader {
|
|||
|
||||
if ( $file ) {
|
||||
$template = locate_template( $find );
|
||||
if ( ! $template || ( get_option( 'woocommerce_status_options' ) && current_user_can( 'manage_options' ) ) )
|
||||
$status_options = get_option( 'woocommerce_status_options', array() );
|
||||
if ( ! $template || ( ! empty( $status_options['template_debug_mode'] ) && current_user_can( 'manage_options' ) ) )
|
||||
$template = WC()->plugin_path() . '/templates/' . $file;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,15 @@
|
|||
* @author WooThemes
|
||||
* @category Core
|
||||
* @package WooCommerce/Uninstaller
|
||||
* @version 1.6.4
|
||||
* @version 2.1.0
|
||||
*/
|
||||
if( !defined('WP_UNINSTALL_PLUGIN') ) exit();
|
||||
if( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
|
||||
exit();
|
||||
|
||||
global $wpdb, $wp_roles;
|
||||
|
||||
$status_options = get_option( 'woocommerce_status_options', array() );
|
||||
|
||||
// Roles + caps
|
||||
$installer = include( 'includes/class-wc-install.php' );
|
||||
$installer->remove_roles();
|
||||
|
@ -42,3 +45,11 @@ $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "woocommerce_tax_rate_lo
|
|||
|
||||
// Delete options
|
||||
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'woocommerce_%';");
|
||||
|
||||
if ( ! empty( $status_options['uninstall_data'] ) ) {
|
||||
// Delete posts + data
|
||||
$wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'product', 'product_variation', 'shop_coupon', 'shop_order' );" );
|
||||
$wpdb->query( "DELETE FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE wp.ID IS NULL;" );
|
||||
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "woocommerce_order_items" );
|
||||
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "woocommerce_order_itemmeta" );
|
||||
}
|
Loading…
Reference in New Issue