From ce857feeedae63ebb0fe69f1d930d326cc490ae0 Mon Sep 17 00:00:00 2001 From: devin Date: Fri, 22 May 2015 16:00:17 -0700 Subject: [PATCH] Removed unnecessary log type --- includes/class-give-logging.php | 2 +- uninstall.php | 82 +++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 uninstall.php diff --git a/includes/class-give-logging.php b/includes/class-give-logging.php index 1db6b25256..e70b98f963 100644 --- a/includes/class-give-logging.php +++ b/includes/class-give-logging.php @@ -84,7 +84,7 @@ public function register_taxonomy() { */ public function log_types() { $terms = array( - 'sale', 'file_download', 'gateway_error', 'api_request' + 'sale', 'gateway_error', 'api_request' ); return apply_filters( 'give_log_types', $terms ); diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 0000000000..2b8e6828f5 --- /dev/null +++ b/uninstall.php @@ -0,0 +1,82 @@ + $post_type, 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids' ) ); + + if ( $items ) { + foreach ( $items as $item ) { + wp_delete_post( $item, true); + } + } + } + + /** Delete All the Terms & Taxonomies */ + foreach ( array_unique( array_filter( $edd_taxonomies ) ) as $taxonomy ) { + + $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); + + // Delete Terms + if ( $terms ) { + foreach ( $terms as $term ) { + $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); + $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); + } + } + + // Delete Taxonomies + $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); + } + + /** Delete the Plugin Pages */ + $edd_created_pages = array( 'purchase_page', 'success_page', 'failure_page', 'purchase_history_page' ); + foreach ( $edd_created_pages as $p ) { + $page = edd_get_option( $p, false ); + if ( $page ) { + wp_delete_post( $page, true ); + } + } + + /** Delete all the Plugin Options */ + delete_option( 'edd_settings' ); + + /** Delete Capabilities */ + EDD()->roles->remove_caps(); + + /** Delete the Roles */ + $edd_roles = array( 'shop_manager', 'shop_accountant', 'shop_worker', 'shop_vendor' ); + foreach ( $edd_roles as $role ) { + remove_role( $role ); + } + + // Remove all database tables + $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "edd_customers" ); + + /** Cleanup Cron Events */ + wp_clear_scheduled_hook( 'edd_daily_scheduled_events' ); + wp_clear_scheduled_hook( 'edd_daily_cron' ); + wp_clear_scheduled_hook( 'edd_weekly_cron' ); +}