Merge pull request 'fix: 修正后台等级图标与认证提示' (#333) from certification-flow-fixed-types into main
Reviewed-on: CYL/wordpress-theme-aksrt#333
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user