Uninstall. Closes #372.

This commit is contained in:
Mike Jolley 2011-12-19 15:44:00 +00:00
parent 665d8bf512
commit b9436bc052
2 changed files with 42 additions and 1 deletions

41
uninstall.php Normal file
View File

@ -0,0 +1,41 @@
<?php
/**
* WooCommerce Uninstall
*
* Uninstalling WooCommerce deletes user roles, options, tables, and pages.
*
* @package WooCommerce
* @category Core
* @author WooThemes
* @since 1.4
*/
if( !defined('WP_UNINSTALL_PLUGIN') ) exit();
global $wpdb, $wp_roles;
// Roles
remove_role( 'customer' );
remove_role( 'shop_manager' );
// Capabilities
$wp_roles->remove_cap( 'administrator', 'manage_woocommerce' );
// Pages
wp_delete_post( get_option('woocommerce_shop_page_id'), true );
wp_delete_post( get_option('woocommerce_cart_page_id'), true );
wp_delete_post( get_option('woocommerce_checkout_page_id'), true );
wp_delete_post( get_option('woocommerce_order_tracking_page_id'), true );
wp_delete_post( get_option('woocommerce_myaccount_page_id'), true );
wp_delete_post( get_option('woocommerce_edit_address_page_id'), true );
wp_delete_post( get_option('woocommerce_view_order_page_id'), true );
wp_delete_post( get_option('woocommerce_change_password_page_id'), true );
wp_delete_post( get_option('woocommerce_pay_page_id'), true );
wp_delete_post( get_option('woocommerce_thanks_page_id'), true );
// Tables
$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."woocommerce_attribute_taxonomies");
$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."woocommerce_downloadable_product_permissions");
$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."woocommerce_termmeta");
// Delete options
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'woocommerce_%';");

View File

@ -2,7 +2,7 @@
/*
Plugin Name: WooCommerce
Plugin URI: http://www.woothemes.com/woocommerce/
Description: An eCommerce plugin for wordpress.
Description: An e-commerce toolkit that helps you sell anything. Beautifully.
Version: 1.4
Author: WooThemes
Author URI: http://woothemes.com