Files
wordpress-theme-aksrt/inc/helpers/user-center-renderers/profile-header.php
T
kate522 a4af024f32 feat(ban): align ban prompts with the reference theme modals and block page
对照参考主题(Zibll)修正四项偏差,申诉链路从页面整体迁移至弹窗:

- feat(ban): 新增三个 1:1 复刻弹窗(REST /user-ban/{info,appeal,log}-modal):
  查看禁封状态(多彩头 c-gray + 信息行 + 申诉按钮)、禁封申诉(edit-header
  gavel/c-blue + 信息框 + 资料项 data[key] 输入 + 审核中态 + 禁止申诉态)、
  禁封记录(多彩头 c-yellow + 计数 + 逐条卡片);user-ban.js 增加
  data-aksrt-ban-info/appeal/log 委托与 admin-ajax 申诉提交
- feat(ban): 禁封/解封弹窗的「当前用户已有N次禁封记录」静态文案改为可点击
  黄链(N>1),打开禁封记录弹窗;解封视图信息行改复用统一数据源
- refactor(ban): 治理展示态收敛至 Restriction::state_badges()(封号=c-red
  违规已封号 / 小黑屋=c-yellow 小黑屋禁封中 / 禁言=c-gray 禁言中,颜色与
  字段统一管理)+ get_ban_info()(状态/起止时间/原因/说明/申诉权限,
  三弹窗与禁封页共用)
- feat(ban): 登录行为对齐参考主题——移除登录期拦截(enforce_login_ban)
  与 complete_login 禁封闸门,封号用户可正常登录;新增 template_redirect
  前台禁封页(1:1 zib_user_ban_restrict_login/zib_die_page:红盒提示 +
  信息行 + 申诉权限 + 退出登录/申诉按钮,模板 templates/parts/user/ban-block.php)
- feat(profile): 公开主页禁封状态从资料卡下方提示框改为占据身份行元信息位
  的 badg 徽章(参考主题 author_header_identity 语义);用户中心元信息改为
  but 按钮(徽章+箭头)打开查看禁封状态弹窗;评论拒绝态链接同源
- refactor: 移除申诉页面模板(page-ban-appeal.php)及其资产/注册/入队、
  get_profile_notice/profile_notice 链、state_labels/state_notices/
  login_ban_message、UserRuntime 的 public_notice/ban_notice_text 死配置、
  report_settings 死键、无消费方的 aksrt_ban_appeal_status 端点
- feat(ban): BanAppeal::ajax_submit 兼容弹窗 data[key] 表单结构
  (逐项清洗入库,申诉说明取 data['申诉说明'],旧平铺字段保持兼容)
- chore: 重新构建 public.css/public.min.css(三个新弹窗几何与头部样式)
- test: 契约测试重写(徽章元信息位、三弹窗与记录链接、禁封页、允许登录 +
  前台拦截、死代码移除断言),全量 362 项通过
2026-09-22 19:14:02 +08:00

108 lines
5.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* User center profile header part.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
?>
<div class="uc-header">
<div class="uc-header__cover">
<img id="aksrt-cover-img" class="uc-header__cover-img" src="<?php echo esc_url($user_background_url); ?>" alt="">
<div class="uc-header__cover-mask"></div>
<div class="aksrt-cover-menu" data-aksrt-menu>
<button type="button" class="aksrt-cover-menu__trigger" aria-haspopup="true" aria-expanded="false" aria-label="<?php esc_attr_e('个人主页操作', 'aksrt'); ?>">
<i class="fa fas fa-ellipsis-h" aria-hidden="true"></i>
</button>
<div class="aksrt-cover-menu__panel" role="menu" hidden>
<a role="menuitem" href="<?php echo esc_url(aksrt_get_user_home_url()); ?>"><i class="fa fas fa-home" aria-hidden="true"></i><?php esc_html_e('我的主页', 'aksrt'); ?></a>
<?php if ($allow_bg_upload) : ?>
<button type="button" role="menuitem" id="aksrt-upload-bg-btn"><i class="fa fas fa-image" aria-hidden="true"></i><span><?php esc_html_e('修改背景图', 'aksrt'); ?></span></button>
<?php endif; ?>
</div>
</div>
<?php if ($allow_bg_upload) : ?><input type="file" id="aksrt-bg-file-input" accept="image/jpeg,image/png,image/webp,image/gif" hidden><?php endif; ?>
</div>
<div class="uc-header__content">
<div class="uc-header__avatar">
<?php echo aksrt_get_avatar_html($user_id, 120, ['id' => 'aksrt-user-avatar-image', 'alt' => $target_user->display_name, 'loading' => 'eager']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php if ($show_avatar_edit) : ?>
<button type="button" id="aksrt-upload-avatar-btn" class="uc-header__avatar-upload" title="<?php esc_attr_e('更换头像', 'aksrt'); ?>" aria-label="<?php esc_attr_e('更换头像', 'aksrt'); ?>">
<i class="fa fas fa-camera" aria-hidden="true"></i>
<span><?php esc_html_e('更换头像', 'aksrt'); ?></span>
</button>
<input type="file" id="aksrt-avatar-file-input" accept="image/jpeg,image/png,image/webp,image/gif" hidden>
<?php endif; ?>
</div>
<div class="uc-header__info">
<h1 class="uc-header__name">
<?php echo esc_html($target_user->display_name); ?>
<?php if (function_exists('aksrt_render_user_identity_chips')) : ?>
<?php echo aksrt_render_user_identity_chips((int) $user_id, 'author', ['include_vip' => true, 'skip_badges' => true]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php endif; ?>
</h1>
<div class="uc-header__meta desc user-identity flex ac hh">
<?php
// 治理状态入口(参考主题 user_page_header_desc 钩子 / zib_get_user_ban_info_link:
// 用户中心「封禁」元信息,点击打开查看禁封状态弹窗 → 申诉弹窗)。
if (function_exists('aksrt_get_user_ban_info_link')) {
echo aksrt_get_user_ban_info_link((int) $user_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- helper escapes internally.
}
?>
<?php if (function_exists('aksrt_render_user_medal_entry')) : ?>
<?php echo aksrt_render_user_medal_entry((int) $user_id, 'user-center', true); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php endif; ?>
<span class="uc-header__meta-item" title="<?php esc_attr_e('用户名', 'aksrt'); ?>">
<i class="fa fas fa-user" aria-hidden="true"></i> <?php echo esc_html($target_user->user_login); ?>
</span>
<?php if ($target_user->user_email) : ?>
<span class="uc-header__meta-item" title="<?php esc_attr_e('邮箱', 'aksrt'); ?>">
<i class="fa fas fa-envelope" aria-hidden="true"></i> <?php echo esc_html($target_user->user_email); ?>
</span>
<?php endif; ?>
<?php
// IP 归属地由扩展设置统一控制。
$uc_city = function_exists('aksrt_get_user_city_badge_html')
? aksrt_get_user_city_badge_html((int) $user_id, 'user_center', 'badg')
: '';
if ($uc_city !== '') {
echo $uc_city; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</div>
</div>
<div class="uc-header__actions">
<?php if (!empty($signin_enabled)) : ?>
<span data-aksrt-signin>
<?php if (!empty($signin_signed_today)) : ?>
<?php echo aksrt_get_user_checkin_details_link('btn btn-sm uc-header__signin-btn is-done', '<i class="fa fas fa-calendar-check" aria-hidden="true"></i><span>' . esc_html__('已签到', 'aksrt') . '</span>'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<button
type="button"
class="btn btn-sm uc-header__signin-btn"
data-signin-btn
data-signin-idle-label="<?php esc_attr_e('签到', 'aksrt'); ?>"
data-signin-done-label="<?php esc_attr_e('已签到', 'aksrt'); ?>"
>
<i class="fa fas fa-calendar-check" aria-hidden="true"></i>
<span data-signin-label><?php esc_html_e('签到', 'aksrt'); ?></span>
</button>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if (!empty($messages_url)) : ?>
<a href="<?php echo esc_url($messages_url); ?>" class="btn-ghost btn-sm btn-icon uc-header__message-btn" aria-label="<?php esc_attr_e('消息通知', 'aksrt'); ?>" title="<?php esc_attr_e('消息通知', 'aksrt'); ?>">
<i class="fa fas fa-bell" aria-hidden="true"></i>
<?php if ($notification_unread_count > 0) : ?>
<span class="uc-header__action-badge"><?php echo esc_html((string) $notification_unread_count); ?></span>
<?php endif; ?>
</a>
<?php endif; ?>
</div>
</div>
</div>