From 387b9e1929776bccb7da369e0c09e280eab34fcd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 Jul 2026 11:36:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=AD=89=E7=BA=A7=E5=9B=BE=E6=A0=87=E4=B8=8E=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/admin/user-level.css | 10 ++++++++++ src/AKSRT/User/Home.php | 2 +- src/AKSRT/User/LevelAdmin.php | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 assets/css/admin/user-level.css diff --git a/assets/css/admin/user-level.css b/assets/css/admin/user-level.css new file mode 100644 index 00000000..f4a51522 --- /dev/null +++ b/assets/css/admin/user-level.css @@ -0,0 +1,10 @@ +#users .aksrt-user-level-icon--admin, +#your-profile .aksrt-user-level-icon--admin, +#profile-page .aksrt-user-level-icon--admin { + display: inline-block; + width: auto; + height: 18px; + max-width: 40px; + object-fit: contain; + vertical-align: middle; +} diff --git a/src/AKSRT/User/Home.php b/src/AKSRT/User/Home.php index 172b346e..64a42082 100644 --- a/src/AKSRT/User/Home.php +++ b/src/AKSRT/User/Home.php @@ -143,7 +143,7 @@ class Home { $application = class_exists('AKSRT\\User\\AuthApply') ? AuthApply::get_apply_payload($user_id) : []; $type = sanitize_key((string) ($info['type'] ?? $application['type'] ?? '')); $type_settings = is_array($settings['verify']['types'][$type] ?? null) ? $settings['verify']['types'][$type] : []; - $label = (string) ($type_settings['badge_text'] ?? $type_settings['label'] ?? __('认证用户', 'aksrt')); + $label = (string) ($type_settings['badge_text'] ?? $type_settings['label'] ?? ''); $signals[] = [ 'type' => 'verify', 'label' => $label, diff --git a/src/AKSRT/User/LevelAdmin.php b/src/AKSRT/User/LevelAdmin.php index aa1853e8..d9467193 100644 --- a/src/AKSRT/User/LevelAdmin.php +++ b/src/AKSRT/User/LevelAdmin.php @@ -25,6 +25,7 @@ class LevelAdmin { if (!is_admin()) { return; } + add_action('admin_enqueue_scripts', [$this, 'enqueue_assets']); add_filter('manage_users_columns', [$this, 'add_column']); add_filter('manage_users_custom_column', [$this, 'render_column'], 10, 3); add_filter('manage_users_sortable_columns', [$this, 'sortable_columns']); @@ -40,6 +41,18 @@ class LevelAdmin { return class_exists(Level::class) && !empty(Level::settings()['enabled']); } + public function enqueue_assets(string $hook): void { + if (!in_array($hook, ['users.php', 'user-edit.php', 'profile.php'], true)) { + return; + } + wp_enqueue_style( + 'aksrt-user-level-admin', + get_theme_file_uri('/assets/css/admin/user-level.css'), + [], + defined('AKSRT_VERSION') ? AKSRT_VERSION : null + ); + } + private function can_manage(int $user_id): bool { return current_user_can('manage_options') && current_user_can('edit_user', $user_id); }