Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191
This commit is contained in:
44
chat/templates/Community Suggestions/uninstall.php
Normal file
44
chat/templates/Community Suggestions/uninstall.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Uninstall Community Suggestions plugin
|
||||
*
|
||||
* @package Community Suggestions
|
||||
*/
|
||||
|
||||
// Prevent direct access
|
||||
if (!defined('WP_UNINSTALL_PLUGIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Remove database tables
|
||||
function pc_community_suggestions_uninstall() {
|
||||
global $wpdb;
|
||||
|
||||
$suggestions_table = $wpdb->prefix . 'pc_community_suggestions';
|
||||
$votes_table = $wpdb->prefix . 'pc_community_votes';
|
||||
|
||||
// Drop tables
|
||||
$wpdb->query("DROP TABLE IF EXISTS $suggestions_table");
|
||||
$wpdb->query("DROP TABLE IF EXISTS $votes_table");
|
||||
|
||||
// Remove options
|
||||
delete_option('pc_community_suggestions_moderation');
|
||||
delete_option('pc_community_suggestions_default_sort');
|
||||
delete_option('pc_community_suggestions_page_id');
|
||||
delete_option('pc_community_suggestions_version');
|
||||
|
||||
// Remove any transients
|
||||
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '%pc_community_suggestions_%'");
|
||||
|
||||
// Remove scheduled events
|
||||
wp_clear_scheduled_hook('pc_community_suggestions_daily_cleanup');
|
||||
|
||||
// Remove the default page if it exists
|
||||
$page_id = get_option('pc_community_suggestions_page_id', 0);
|
||||
if ($page_id && get_post_type($page_id) === 'page') {
|
||||
wp_delete_post($page_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Run uninstall function
|
||||
pc_community_suggestions_uninstall();
|
||||
Reference in New Issue
Block a user