- apply_report_action now writes aksrt_user_restriction via Restriction::restrict
and lifts via new lift_user_restriction(), replacing the display-only
aksrt_user_ban_state meta dual-track
- ban type restrictions destroy the target user's sessions on apply
- appeal approval lifts active ban/suspend/mute restrictions instead of
updating a nonexistent status column
- UsersBan.vue posts to /users/{id}/restrict with valid types (warn/mute/
suspend/ban), scope and expires_at
- add comment report entry to the comment actions dropdown
- add duplicate pending report guard on submit
- remove dead ReportCenter ajax handlers, option migration, REST alias
routes and write-only restriction meta
- fix report admin mail link to the real aksrt_user_ban page
- add report-ban contract tests
83 lines
2.1 KiB
PHP
83 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* AKSRT Theme — Uninstall Handler
|
|
*
|
|
* Runs when the theme is deleted via the WordPress admin.
|
|
* Optionally cleans up custom database tables and options.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
// Abort if not called by WordPress
|
|
if (!defined('WP_UNINSTALL_PLUGIN') && !defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
// Only run if the user has opted in to data deletion.
|
|
// Check for a specific option flag; if not set, preserve data.
|
|
$should_cleanup = get_option('aksrt_cleanup_on_uninstall', false);
|
|
if (!$should_cleanup) {
|
|
return;
|
|
}
|
|
|
|
global $wpdb;
|
|
|
|
// ── Drop custom tables ──
|
|
$tables = [
|
|
'aksrt_financial_flow_entry',
|
|
'aksrt_financial_flow',
|
|
'aksrt_asset_entry',
|
|
'aksrt_asset_transaction',
|
|
'aksrt_asset_account',
|
|
'aksrt_signin_log',
|
|
'aksrt_dl_token',
|
|
'aksrt_notification',
|
|
'aksrt_report',
|
|
'aksrt_follow',
|
|
'aksrt_user_restriction',
|
|
'aksrt_product_variant',
|
|
'aksrt_after_sale',
|
|
'aksrt_order_shipping',
|
|
'aksrt_card_key',
|
|
'aksrt_revenue',
|
|
'aksrt_withdrawal',
|
|
'aksrt_charge_card',
|
|
];
|
|
|
|
foreach ($tables as $table) {
|
|
$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}{$table}");
|
|
}
|
|
|
|
// ── Delete AKSRT options ──
|
|
$options = $wpdb->get_col(
|
|
"SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE 'aksrt_%'"
|
|
);
|
|
if ($options) {
|
|
foreach ($options as $option) {
|
|
delete_option($option);
|
|
}
|
|
}
|
|
|
|
// ── Delete AKSRT user meta ──
|
|
$meta_keys = [
|
|
'aksrt_avatar_attachment_id',
|
|
'aksrt_background_attachment_id',
|
|
'aksrt_background_image',
|
|
'aksrt_email_verified',
|
|
'aksrt_unread_message_count',
|
|
'_aksrt_active_restrictions',
|
|
'_aksrt_is_banned',
|
|
'aksrt_user_ban_state',
|
|
'_aksrt_favorite_posts',
|
|
'aksrt_wechat_openid',
|
|
'aksrt_wechat_subscriptions',
|
|
];
|
|
|
|
foreach ($meta_keys as $key) {
|
|
$wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s", $key));
|
|
}
|
|
|
|
// ── Delete transients ──
|
|
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_aksrt_%'");
|
|
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_aksrt_%'");
|