fix(identity): align vip icons and sidebar cards
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,11 @@ if (!function_exists('aksrt_render_user_identity_chips')) {
|
||||
}
|
||||
}
|
||||
$signals = aksrt_get_user_identity_signals($user_id);
|
||||
// Keep the public identity order stable: certification, worn badge, level.
|
||||
usort($signals, static function (array $left, array $right): int {
|
||||
$priority = ['verify' => 0, 'badge' => 1, 'level' => 2];
|
||||
return ($priority[(string) ($left['type'] ?? '')] ?? 3) <=> ($priority[(string) ($right['type'] ?? '')] ?? 3);
|
||||
});
|
||||
// Comments stay compact; author/card can show more.
|
||||
$limit = $context === 'comment' ? 3 : 6;
|
||||
$n = 0;
|
||||
@@ -116,7 +121,7 @@ if (!function_exists('aksrt_get_user_name')) {
|
||||
'id' => 0,
|
||||
'class' => 'flex ac flex1',
|
||||
'name_class' => '',
|
||||
'vip' => false,
|
||||
'vip' => true,
|
||||
'medal' => true,
|
||||
'auth' => true,
|
||||
'level' => true,
|
||||
@@ -148,7 +153,7 @@ if (!function_exists('aksrt_get_user_name')) {
|
||||
$vip_html = (string) aksrt_render_vip_badge($user_id, 'sm');
|
||||
}
|
||||
$name_class = trim('display-name text-ellipsis ' . (string) $args['name_class']);
|
||||
$name_link = '<a class="' . esc_attr($name_class) . '" href="' . esc_url($home) . '">' . $vip_html . esc_html($display) . '</a>';
|
||||
$name_link = '<a class="' . esc_attr($name_class) . '" href="' . esc_url($home) . '">' . esc_html($display) . '</a>';
|
||||
|
||||
$auth_html = '';
|
||||
$medal_html = '';
|
||||
@@ -217,7 +222,7 @@ if (!function_exists('aksrt_get_user_name')) {
|
||||
}
|
||||
|
||||
// Order: name → auth → wear medal → level → follow (Zibll).
|
||||
$html = '<name class="' . esc_attr((string) $args['class']) . '">' . $name_link . $auth_html . $medal_html . $level_html . $follow_html . '</name>';
|
||||
$html = '<name class="' . esc_attr((string) $args['class']) . '">' . $name_link . $vip_html . $auth_html . $medal_html . $level_html . $follow_html . '</name>';
|
||||
/**
|
||||
* Filter rendered user name chrome.
|
||||
*
|
||||
|
||||
@@ -238,7 +238,7 @@ if (!function_exists('aksrt_header_user_box_html')) :
|
||||
$con .= $avatar;
|
||||
$con .= '<div class="user-right flex flex1 ac jsb ml10">';
|
||||
$con .= '<div class="flex1" style="max-width: calc(100% - 40px);"><b>'
|
||||
. '<span class="display-name text-ellipsis">' . esc_html($display_name) . '</span>' . $vip_badge . $level_badge . $certification_badge
|
||||
. '<span class="display-name text-ellipsis">' . esc_html($display_name) . '</span>' . $vip_badge . $certification_badge . $level_badge
|
||||
. '</b><div class="px12 muted-2-color text-ellipsis">' . esc_html($desc) . '</div></div>';
|
||||
$con .= '</div>';
|
||||
$con .= $msg_icon;
|
||||
|
||||
@@ -36,32 +36,10 @@ extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_
|
||||
<div class="uc-header__info">
|
||||
<h1 class="uc-header__name">
|
||||
<?php echo esc_html($target_user->display_name); ?>
|
||||
<?php
|
||||
$vip_badge = function_exists('aksrt_render_vip_badge') ? aksrt_render_vip_badge($user_id) : '';
|
||||
if ($vip_badge) {
|
||||
echo $vip_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
// Worn medal icon inline to the right of the name (zibll parity).
|
||||
if (function_exists('aksrt_get_worn_medal_icon')) {
|
||||
echo aksrt_get_worn_medal_icon((int) $user_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
// Level icon inline to the right of the name (zibll parity).
|
||||
if (class_exists('\AKSRT\User\Level') && method_exists('\AKSRT\User\Level', 'get_badge_html')) {
|
||||
echo \AKSRT\User\Level::get_badge_html((int) $user_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
foreach ($profile_signals as $signal) {
|
||||
if ((string) ($signal['type'] ?? '') !== 'verify') {
|
||||
continue;
|
||||
}
|
||||
$icon_url = esc_url((string) ($signal['icon_url'] ?? ''));
|
||||
if ($icon_url !== '') {
|
||||
echo '<img class="aksrt-identity-certification-icon img-icon ml3" src="' . $icon_url . '" alt="" title="' . esc_attr((string) ($signal['title'] ?? $signal['label'] ?? '')) . '" loading="lazy" decoding="async" />';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</h1>
|
||||
<?php if (function_exists('aksrt_render_user_identity_chips')) : ?>
|
||||
<?php echo aksrt_render_user_identity_chips((int) $user_id, 'author', ['include_vip' => true]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php endif; ?>
|
||||
</h1>
|
||||
<div class="uc-header__meta desc user-identity flex ac hh">
|
||||
<span class="uc-header__meta-item" title="<?php esc_attr_e('用户名', 'aksrt'); ?>">
|
||||
<i class="fas fa-user" aria-hidden="true"></i> <?php echo esc_html($target_user->user_login); ?>
|
||||
|
||||
Reference in New Issue
Block a user