feat(admin): fully align the ban page with the reference theme

- submenu page title becomes 处理举报及禁封申诉 (menu title 举报&禁封申诉)
- replicate the reference pagenavi: first/prev/numbered/next/last links
  with displaying-num (每页 20 共N) and paging-input (第X页共Y页)
- report process form is now status-only like the reference theme:
  被举报用户/举报信息/被举报用户禁封信息/处理说明 blocks, with a 点击此处
  link to the restrictions tab (prefilled user_id) instead of an
  enforcement select
- replicate reference row details (举报用户/举报内容, 正在处理 state,
  此用户已解封 auto-close for stale appeals, 当前用户已解封 notice) and
  the table-box/preview-item style block
- drop now-unused ReportCenter::get_report_row
This commit is contained in:
kate522 committed 2026-09-19 22:09:24 +08:00
1 parent 902e71ee62
commit c0e0912eee
4 files changed
+100 -98

No files matched your search

+6 -23
View File
@@ -82,7 +82,7 @@ class UsersMenus {
);
add_submenu_page(
'users.php',
__('举报&禁封申诉', 'aksrt'),
__('处理举报及禁封申诉', 'aksrt'),
__('举报&禁封申诉', 'aksrt'),
self::CAPABILITY,
'aksrt_user_ban',
@@ -324,7 +324,7 @@ class UsersMenus {
echo '<form method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="margin-bottom:20px;display:flex;gap:8px;flex-wrap:wrap;align-items:end;">';
echo '<input type="hidden" name="action" value="aksrt_users_add_restriction" />';
wp_nonce_field('aksrt_users_add_restriction');
echo '<p><label>' . esc_html__('用户 ID', 'aksrt') . '<br><input type="number" name="user_id" min="1" required /></label></p>';
echo '<p><label>' . esc_html__('用户 ID', 'aksrt') . '<br><input type="number" name="user_id" min="1" required value="' . esc_attr((string) (isset($_GET['user_id']) ? max(0, (int) $_GET['user_id']) : 0)) . '" /></label></p>';
echo '<p><label>' . esc_html__('类型', 'aksrt') . '<br><select name="type">';
foreach (['warn' => __('警告', 'aksrt'), 'mute' => __('禁言', 'aksrt'), 'suspend' => __('停权', 'aksrt'), 'ban' => __('封禁', 'aksrt')] as $key => $label) {
printf('<option value="%s">%s</option>', esc_attr($key), esc_html($label));
@@ -377,28 +377,11 @@ class UsersMenus {
if (!current_user_can(self::CAPABILITY)) {
wp_die(esc_html__('权限不足', 'aksrt'));
}
$id = isset($_POST['report_id']) ? (int) $_POST['report_id'] : 0;
$new_status = isset($_POST['new_status']) ? sanitize_key((string) wp_unslash($_POST['new_status'])) : '';
$note = isset($_POST['note']) ? sanitize_textarea_field((string) wp_unslash($_POST['note'])) : '';
$action_taken = isset($_POST['action_taken']) ? sanitize_key((string) wp_unslash($_POST['action_taken'])) : 'none';
$id = isset($_POST['report_id']) ? (int) $_POST['report_id'] : 0;
$new_status = isset($_POST['new_status']) ? sanitize_key((string) wp_unslash($_POST['new_status'])) : '';
$note = isset($_POST['note']) ? sanitize_textarea_field((string) wp_unslash($_POST['note'])) : '';
check_admin_referer('aksrt_users_update_report_' . $id);
$ok = false;
if ($id > 0 && class_exists('\AKSRT\Messages\ReportCenter')) {
$svc = \AKSRT\Messages\ReportCenter::get_instance();
$ok = $svc->update_status($id, $new_status, $note);
if ($ok && $action_taken !== '' && $action_taken !== 'none') {
$row = $svc->get_report_row($id);
if ($row) {
$svc->apply_action(
sanitize_key((string) $row['target_type']),
(int) $row['target_id'],
$action_taken,
(string) ($row['reason'] ?? '')
);
}
}
}
$ok = $id > 0 && class_exists('\AKSRT\Messages\ReportCenter') && \AKSRT\Messages\ReportCenter::get_instance()->update_status($id, $new_status, $note);
$this->redirect('aksrt_user_ban', $ok ? 'report_updated' : 'report_failed', ['tab' => 'tickets']);
}