fix: 修正后台等级图标与认证提示

This commit is contained in:
kate522 committed 2026-07-31 11:36:33 +08:00
1 parent d9a3685001
commit 387b9e1929
3 files changed
+24 -1

No files matched your search

+10
View File
@@ -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;
}
+1 -1
View File
@@ -143,7 +143,7 @@ class Home {
$application = class_exists('AKSRT\\User\\AuthApply') ? AuthApply::get_apply_payload($user_id) : []; $application = class_exists('AKSRT\\User\\AuthApply') ? AuthApply::get_apply_payload($user_id) : [];
$type = sanitize_key((string) ($info['type'] ?? $application['type'] ?? '')); $type = sanitize_key((string) ($info['type'] ?? $application['type'] ?? ''));
$type_settings = is_array($settings['verify']['types'][$type] ?? null) ? $settings['verify']['types'][$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[] = [ $signals[] = [
'type' => 'verify', 'type' => 'verify',
'label' => $label, 'label' => $label,
+13
View File
@@ -25,6 +25,7 @@ class LevelAdmin {
if (!is_admin()) { if (!is_admin()) {
return; return;
} }
add_action('admin_enqueue_scripts', [$this, 'enqueue_assets']);
add_filter('manage_users_columns', [$this, 'add_column']); add_filter('manage_users_columns', [$this, 'add_column']);
add_filter('manage_users_custom_column', [$this, 'render_column'], 10, 3); add_filter('manage_users_custom_column', [$this, 'render_column'], 10, 3);
add_filter('manage_users_sortable_columns', [$this, 'sortable_columns']); add_filter('manage_users_sortable_columns', [$this, 'sortable_columns']);
@@ -40,6 +41,18 @@ class LevelAdmin {
return class_exists(Level::class) && !empty(Level::settings()['enabled']); 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 { private function can_manage(int $user_id): bool {
return current_user_can('manage_options') && current_user_can('edit_user', $user_id); return current_user_can('manage_options') && current_user_can('edit_user', $user_id);
} }