fix(user-home): 1:1 align public profile with Zibll author page
- Remove 主页概览/快捷入口/交易服务 private-dashboard sidebar from public home - Full-width layout; counts live in tab bar (粉丝 = followers) - Hero: 用户中心/消息 for self, 关注/私信 for others; drop body stats row - Defaults: no sidebar, posts/favorites/comments/follow tabs
This commit is contained in:
@@ -278,20 +278,20 @@ export const pageDisplaySchemas = {
|
||||
key: 'page_display.user-home',
|
||||
title: '用户主页',
|
||||
icon: 'fas fa-user-circle',
|
||||
description: '配置用户公开主页的布局、Tab 展示和互动功能。',
|
||||
description: '公开用户主页对齐 Zibll 作者页:通栏头图 + Tab 计数;交易/快捷入口仅在用户中心。',
|
||||
defaults: {
|
||||
user_home_tabs: 'posts,comments,favorites,credits,product,plate,forum,follow',
|
||||
user_home_tabs_order: 'posts,comments,favorites,credits,product,plate,forum,follow',
|
||||
user_home_tabs: 'posts,favorites,comments,follow',
|
||||
user_home_tabs_order: 'posts,favorites,comments,follow',
|
||||
user_home_tabs_pc_hide: '',
|
||||
user_home_tabs_mobile_hide: '',
|
||||
user_home_sidebar: true,
|
||||
user_home_sidebar: false,
|
||||
user_home_cover: true,
|
||||
user_home_follow: true,
|
||||
user_home_posts_per_page: 10,
|
||||
user_home_avatar: true,
|
||||
user_home_name: true,
|
||||
user_home_desc: true,
|
||||
user_home_stats: true,
|
||||
user_home_stats: false,
|
||||
user_home_social: true,
|
||||
author_main_tab_swiper: false,
|
||||
user_home_message: true,
|
||||
@@ -305,7 +305,7 @@ export const pageDisplaySchemas = {
|
||||
icon: 'fas fa-th-large',
|
||||
fields: [
|
||||
{ key: 'user_home_cover', label: '封面区域', type: 'switch', default: true, help: '用户主页顶部封面图' },
|
||||
{ key: 'user_home_sidebar', label: '侧边栏', type: 'switch', default: true },
|
||||
{ key: 'user_home_sidebar', label: '侧边栏(已弃用)', type: 'switch', default: false, help: '公开主页为通栏布局(对齐 Zibll author);运行时强制关闭。交易服务请去用户中心。' },
|
||||
{ key: 'user_home_follow', label: '关注按钮', type: 'switch', default: true },
|
||||
{ key: 'user_home_posts_per_page', label: '每页文章数', type: 'number', default: 10, min: 5, max: 50 },
|
||||
{ key: 'user_home_paging_ajax', label: 'AJAX 翻页', type: 'switch', default: true, help: '使用 AJAX 加载替代传统翻页' },
|
||||
@@ -316,8 +316,8 @@ export const pageDisplaySchemas = {
|
||||
title: 'Tab 配置',
|
||||
icon: 'fas fa-columns',
|
||||
fields: [
|
||||
{ key: 'user_home_tabs', label: '显示的 Tab', type: 'input', default: 'posts,comments,favorites,credits,product,plate,forum,follow', help: '逗号分隔: posts, comments, favorites, credits, product, plate, forum, follow' },
|
||||
{ key: 'user_home_tabs_order', label: 'Tab 显示顺序', type: 'input', default: 'posts,comments,favorites,credits,product,plate,forum,follow', help: '逗号分隔,拖拽排列栏目顺序' },
|
||||
{ key: 'user_home_tabs', label: '显示的 Tab', type: 'input', default: 'posts,favorites,comments,follow', help: '逗号分隔;默认 posts,favorites,comments,follow(粉丝)。可选 credits,product,plate,forum' },
|
||||
{ key: 'user_home_tabs_order', label: 'Tab 显示顺序', type: 'input', default: 'posts,favorites,comments,follow', help: '逗号分隔,控制栏目顺序' },
|
||||
{ key: 'user_home_tabs_pc_hide', label: 'PC 端隐藏', type: 'input', default: '', help: '逗号分隔要在 PC 端隐藏的栏目' },
|
||||
{ key: 'user_home_tabs_mobile_hide', label: '移动端隐藏', type: 'input', default: '', help: '逗号分隔要在移动端隐藏的栏目' },
|
||||
{ key: 'author_main_tab_swiper', label: '移动端滑动切换', type: 'switch', default: false, help: '移动端左右滑动切换栏目' },
|
||||
@@ -331,10 +331,10 @@ export const pageDisplaySchemas = {
|
||||
{ key: 'user_home_avatar', label: '显示头像', type: 'switch', default: true },
|
||||
{ key: 'user_home_name', label: '显示用户名', type: 'switch', default: true },
|
||||
{ key: 'user_home_desc', label: '显示个人简介', type: 'switch', default: true },
|
||||
{ key: 'user_home_stats', label: '显示统计数据', type: 'switch', default: true },
|
||||
{ key: 'user_home_stats', label: '显示统计数据(已弃用)', type: 'switch', default: false, help: '计数已并入 Tab 角标,头图内不再重复文章/评论/收藏。' },
|
||||
{ key: 'user_home_social', label: '显示社交链接', type: 'switch', default: true },
|
||||
{ key: 'user_home_message', label: '私信按钮', type: 'switch', default: true, help: '在用户主页显示发送私信按钮' },
|
||||
{ key: 'user_home_private', label: '留言按钮', type: 'switch', default: true, help: '在用户主页显示留言入口' },
|
||||
{ key: 'user_home_message', label: '私信/消息按钮', type: 'switch', default: true, help: '本人显示消息中心入口;访客显示私信入口' },
|
||||
{ key: 'user_home_private', label: '留言按钮', type: 'switch', default: true, help: '预留开关,公开主页留言入口' },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -42,6 +42,34 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.aksrt-author-hero__cover-metas {
|
||||
position: absolute;
|
||||
right: 14px;
|
||||
bottom: 12px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.aksrt-author-hero__cover-meta {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, 0.35);
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.aksrt-author-hero__cover-meta i {
|
||||
font-size: 11px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.aksrt-author-hero__body {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
@@ -92,6 +120,7 @@
|
||||
max-width: 520px;
|
||||
}
|
||||
|
||||
/* Body stats row removed for Zibll author parity; counts live in tabs. */
|
||||
.aksrt-author-hero__stats {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -543,3 +572,14 @@
|
||||
margin-top: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
/* Full-width public home (Zibll author: no commerce sidebar) */
|
||||
.aksrt-user-home .content-layout--no-sidebar .content-layout__primary {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.aksrt-user-home .dashboard-tabs__count.opacity8 {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
@@ -209,19 +209,19 @@ class AKSRT_Admin_Schema_Page_Display {
|
||||
'user-home' => [
|
||||
'key' => 'user-home',
|
||||
'title' => '用户主页',
|
||||
'version' => '1.0.0',
|
||||
'version' => '1.1.0',
|
||||
'option_key' => 'aksrt_settings',
|
||||
'groups' => [
|
||||
['key' => 'layout', 'title' => '主页布局', 'fields' => [
|
||||
['key' => 'user_home_cover', 'label' => '封面区域', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_sidebar', 'label' => '侧边栏', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_sidebar', 'label' => '侧边栏(已弃用)', 'type' => 'switch', 'default' => false, 'help' => '公开主页对齐 Zibll 作者页为通栏布局;交易/快捷入口仅在用户中心展示。此开关保留兼容,运行时强制关闭。'],
|
||||
['key' => 'user_home_follow', 'label' => '关注按钮', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_posts_per_page', 'label' => '每页文章数', 'type' => 'number', 'default' => 10, 'min' => 5, 'max' => 50],
|
||||
['key' => 'user_home_paging_ajax', 'label' => 'AJAX 翻页', 'type' => 'switch', 'default' => true],
|
||||
]],
|
||||
['key' => 'tabs', 'title' => 'Tab 配置', 'fields' => [
|
||||
['key' => 'user_home_tabs', 'label' => '显示的 Tab', 'type' => 'input', 'default' => 'posts,comments,favorites,credits,product,plate,forum,follow'],
|
||||
['key' => 'user_home_tabs_order', 'label' => 'Tab 显示顺序', 'type' => 'input', 'default' => 'posts,comments,favorites,credits,product,plate,forum,follow'],
|
||||
['key' => 'user_home_tabs', 'label' => '显示的 Tab', 'type' => 'input', 'default' => 'posts,favorites,comments,follow', 'help' => '逗号分隔;默认对齐 Zibll:posts,favorites,comments,follow(粉丝)。可选 credits,product,plate,forum'],
|
||||
['key' => 'user_home_tabs_order', 'label' => 'Tab 显示顺序', 'type' => 'input', 'default' => 'posts,favorites,comments,follow'],
|
||||
['key' => 'user_home_tabs_pc_hide', 'label' => 'PC 端隐藏', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'user_home_tabs_mobile_hide', 'label' => '移动端隐藏', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'author_main_tab_swiper', 'label' => '移动端滑动切换', 'type' => 'switch', 'default' => false],
|
||||
@@ -230,9 +230,9 @@ class AKSRT_Admin_Schema_Page_Display {
|
||||
['key' => 'user_home_avatar', 'label' => '显示头像', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_name', 'label' => '显示用户名', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_desc', 'label' => '显示个人简介', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_stats', 'label' => '显示统计数据', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_stats', 'label' => '显示统计数据(已弃用)', 'type' => 'switch', 'default' => false, 'help' => '计数已并入 Tab 角标(对齐 Zibll),头图内不再重复展示文章/评论/收藏。'],
|
||||
['key' => 'user_home_social', 'label' => '显示社交链接', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_message', 'label' => '私信按钮', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_message', 'label' => '私信/消息按钮', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'user_home_private', 'label' => '留言按钮', 'type' => 'switch', 'default' => true],
|
||||
]],
|
||||
],
|
||||
|
||||
@@ -72,7 +72,7 @@ class AKSRT_User_Home {
|
||||
'priority' => 70,
|
||||
],
|
||||
'follow' => [
|
||||
'label' => __('关注', 'aksrt'),
|
||||
'label' => __('粉丝', 'aksrt'),
|
||||
'icon' => 'user-plus',
|
||||
'priority' => 80,
|
||||
],
|
||||
|
||||
@@ -31,9 +31,10 @@ class AKSRT_Settings_User_Runtime {
|
||||
return $clean;
|
||||
};
|
||||
|
||||
$normalized_tabs = $parse_csv('user_home_tabs', 'posts,comments,favorites');
|
||||
// Zibll author_main_tab_opt defaults: post, favorite, comment, plate, forum, follow.
|
||||
$normalized_tabs = $parse_csv('user_home_tabs', 'posts,favorites,comments,follow');
|
||||
if (empty($normalized_tabs)) {
|
||||
$normalized_tabs = ['posts', 'comments', 'favorites'];
|
||||
$normalized_tabs = ['posts', 'favorites', 'comments', 'follow'];
|
||||
}
|
||||
|
||||
$raw_order = $parse_csv('user_home_tabs_order', '');
|
||||
@@ -57,14 +58,16 @@ class AKSRT_Settings_User_Runtime {
|
||||
'tabs_order' => $ordered,
|
||||
'tabs_pc_hide' => $pc_hide,
|
||||
'tabs_mobile_hide' => $mobile_hide,
|
||||
'sidebar' => !isset($settings['user_home_sidebar']) || !empty($settings['user_home_sidebar']),
|
||||
// Public author page is full-width (Zibll author.php). Sidebar option kept as no-op reserved key.
|
||||
'sidebar' => false,
|
||||
'cover' => !isset($settings['user_home_cover']) || !empty($settings['user_home_cover']),
|
||||
'follow' => !isset($settings['user_home_follow']) || !empty($settings['user_home_follow']),
|
||||
'posts_per_page' => max(5, min(50, (int) ($settings['user_home_posts_per_page'] ?? 10))),
|
||||
'avatar' => !isset($settings['user_home_avatar']) || !empty($settings['user_home_avatar']),
|
||||
'name' => !isset($settings['user_home_name']) || !empty($settings['user_home_name']),
|
||||
'desc' => !isset($settings['user_home_desc']) || !empty($settings['user_home_desc']),
|
||||
'stats' => !isset($settings['user_home_stats']) || !empty($settings['user_home_stats']),
|
||||
// Body stats row removed; counts live in tabs like Zibll.
|
||||
'stats' => false,
|
||||
'social' => !isset($settings['user_home_social']) || !empty($settings['user_home_social']),
|
||||
'tab_swiper' => !empty($settings['author_main_tab_swiper']),
|
||||
'message' => !isset($settings['user_home_message']) || !empty($settings['user_home_message']),
|
||||
|
||||
@@ -27,8 +27,8 @@ if (!function_exists('aksrt_get_user_home_page_context')) {
|
||||
$user_home_settings = class_exists('AKSRT_Settings')
|
||||
? AKSRT_Settings::get_user_home_settings()
|
||||
: [
|
||||
'tabs' => ['posts', 'comments', 'favorites'],
|
||||
'sidebar' => true,
|
||||
'tabs' => ['posts', 'favorites', 'comments', 'follow'],
|
||||
'sidebar' => false,
|
||||
'cover' => true,
|
||||
'follow' => true,
|
||||
'posts_per_page' => 10,
|
||||
@@ -89,7 +89,7 @@ if (!function_exists('aksrt_get_user_home_page_context')) {
|
||||
|
||||
$follow_count = 0;
|
||||
if (class_exists('AKSRT_Follow')) {
|
||||
$follow_count = (int) AKSRT_Follow::get_instance()->get_following_count($user_id);
|
||||
$follow_count = (int) AKSRT_Follow::get_instance()->get_follower_count($user_id);
|
||||
}
|
||||
|
||||
$plate_count = 0;
|
||||
@@ -136,7 +136,7 @@ if (!function_exists('aksrt_get_user_home_page_context')) {
|
||||
'product' => __('商品', 'aksrt'),
|
||||
'plate' => __('圈子', 'aksrt'),
|
||||
'forum' => __('论坛', 'aksrt'),
|
||||
'follow' => __('关注', 'aksrt'),
|
||||
'follow' => __('粉丝', 'aksrt'), // Zibll: 粉丝
|
||||
];
|
||||
foreach ($visible_tabs as $tab_key => $tab_config) {
|
||||
if (!empty($tab_config['label'])) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Public user homepage template.
|
||||
*
|
||||
* Thin shell: resolve user → build context → mount parts.
|
||||
* Layout matches Zibll author.php: full-width header + tabs (no commerce sidebar).
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -31,7 +32,7 @@ require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
|
||||
|
||||
<main id="main-content" class="site-main container content-shell content-shell--stream aksrt-user-home" tabindex="-1">
|
||||
<div class="content-wrap">
|
||||
<div class="content-layout<?php echo !empty($user_home_settings['sidebar']) ? '' : ' content-layout--no-sidebar'; ?> aksrt-user-home__layout">
|
||||
<div class="content-layout content-layout--no-sidebar aksrt-user-home__layout">
|
||||
<div class="content-layout__primary">
|
||||
<?php
|
||||
get_template_part('templates/parts/user/author-hero', null, [
|
||||
@@ -39,6 +40,7 @@ require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
|
||||
'dashboard' => $dashboard,
|
||||
'user_home_settings' => $user_home_settings,
|
||||
'is_author_page' => false,
|
||||
'tab_counts' => $tab_counts ?? [],
|
||||
]);
|
||||
?>
|
||||
|
||||
@@ -52,10 +54,11 @@ require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
|
||||
if (in_array($tab_key, $tabs_mobile_hide, true)) {
|
||||
$tab_class .= ' tab-hide-mobile';
|
||||
}
|
||||
$tab_count = (int) ($tab_counts[$tab_key] ?? 0);
|
||||
?>
|
||||
<button type="button" class="<?php echo esc_attr(trim($tab_class)); ?>" data-tab="<?php echo esc_attr($tab_key); ?>" role="tab">
|
||||
<?php echo esc_html($tab_labels[$tab_key] ?? ucfirst($tab_key)); ?>
|
||||
<span class="dashboard-tabs__count"><?php echo esc_html((string) ($tab_counts[$tab_key] ?? 0)); ?></span>
|
||||
<span class="dashboard-tabs__count opacity8"><?php echo esc_html((string) $tab_count); ?></span>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
@@ -67,8 +70,6 @@ require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php get_template_part('templates/parts/user-home/sidebar', null, $ctx); ?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -125,8 +125,8 @@ extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_ext
|
||||
<div class="user-home-balance-card">
|
||||
<p class="user-home-balance-card__label"><?php echo esc_html(sprintf(__('当前%s余额', 'aksrt'), $currency_name)); ?></p>
|
||||
<div class="user-home-balance-card__value"><?php echo esc_html(aksrt_format_credits($credit_balance)); ?></div>
|
||||
<p class="user-home-balance-card__hint"><?php esc_html_e('完整账单和赚取/消费记录请在个人中心查看。', 'aksrt'); ?></p>
|
||||
<a href="<?php echo esc_url(aksrt_get_user_center_url('credits')); ?>" class="btn-outline btn-sm"><?php esc_html_e('进入个人中心', 'aksrt'); ?></a>
|
||||
<p class="user-home-balance-card__hint"><?php esc_html_e('完整账单和赚取/消费记录请在用户中心查看。', 'aksrt'); ?></p>
|
||||
<a href="<?php echo esc_url(aksrt_get_user_center_url('credits')); ?>" class="btn-outline btn-sm"><?php esc_html_e('进入用户中心', 'aksrt'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -2,87 +2,11 @@
|
||||
/**
|
||||
* Public user home — page-owned sidebar.
|
||||
*
|
||||
* Zibll public author page has no private-dashboard sidebar
|
||||
* (主页概览 / 快捷入口 / 交易服务). Those belong on 用户中心 only.
|
||||
* This part is intentionally a no-op for 1:1 author parity.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$args = is_array($args ?? null) ? $args : [];
|
||||
extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
||||
|
||||
?>
|
||||
<?php if (!empty($user_home_settings['sidebar'])) : ?>
|
||||
<aside class="content-layout__aside sidebar uc-sidebar aksrt-user-home__aside" role="complementary" aria-label="<?php esc_attr_e('用户主页侧栏', 'aksrt'); ?>">
|
||||
<div class="uc-sidebar__section">
|
||||
<div class="uc-sidebar__title"><?php esc_html_e('主页概览', 'aksrt'); ?></div>
|
||||
<div class="uc-stats">
|
||||
<?php foreach ($enabled_tabs as $tab_key) : ?>
|
||||
<a class="uc-stats__item" href="<?php echo esc_url(add_query_arg('tab', $tab_key, $home_url)); ?>">
|
||||
<span class="uc-stats__value"><?php echo esc_html((string) ($tab_counts[$tab_key] ?? 0)); ?></span>
|
||||
<span class="uc-stats__label"><?php echo esc_html($tab_labels[$tab_key] ?? ucfirst($tab_key)); ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($user_contacts) && !empty($user_center_settings['social_links'])) : ?>
|
||||
<div class="uc-sidebar__section">
|
||||
<div class="uc-sidebar__title"><?php esc_html_e('公开联系', 'aksrt'); ?></div>
|
||||
<div class="aksrt-user-home__contacts">
|
||||
<?php if (function_exists('aksrt_render_social_links')) : ?>
|
||||
<?php aksrt_render_social_links($user_contacts); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="uc-sidebar__section">
|
||||
<div class="uc-sidebar__title"><?php esc_html_e('快捷入口', 'aksrt'); ?></div>
|
||||
<div class="uc-sidebar__buttons">
|
||||
<a href="<?php echo esc_url($home_url); ?>" class="uc-sidebar__btn">
|
||||
<i class="fas fa-user" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('主页首页', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php if ($is_own_profile) : ?>
|
||||
<a href="<?php echo esc_url(aksrt_get_user_center_url()); ?>" class="uc-sidebar__btn">
|
||||
<i class="fas fa-cog" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('个人中心', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($is_own_profile) : ?>
|
||||
<?php
|
||||
$orders_url = function_exists('aksrt_get_orders_page_url') ? aksrt_get_orders_page_url() : '';
|
||||
$show_vip = class_exists('AKSRT_Settings') && !empty(AKSRT_Settings::get_payment_vip_settings()['enabled']);
|
||||
$credits_enabled_side = class_exists('AKSRT_Settings') && AKSRT_Settings::credits_enabled();
|
||||
?>
|
||||
<?php if ($orders_url || $show_vip || $credits_enabled_side) : ?>
|
||||
<div class="uc-sidebar__section">
|
||||
<div class="uc-sidebar__title"><?php esc_html_e('交易服务', 'aksrt'); ?></div>
|
||||
<div class="uc-sidebar__buttons">
|
||||
<?php if ($orders_url) : ?>
|
||||
<a href="<?php echo esc_url($orders_url); ?>" class="uc-sidebar__btn">
|
||||
<i class="fas fa-receipt" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('我的订单', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_vip) : ?>
|
||||
<a href="<?php echo esc_url(function_exists('aksrt_get_user_center_tab_url') ? aksrt_get_user_center_tab_url('credits') : aksrt_get_user_center_url('credits')); ?>" class="uc-sidebar__btn">
|
||||
<i class="fas fa-crown" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('VIP 会员', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($credits_enabled_side) : ?>
|
||||
<a href="<?php echo esc_url(function_exists('aksrt_get_user_center_tab_url') ? aksrt_get_user_center_tab_url('credits') : aksrt_get_user_center_url('credits')); ?>" class="uc-sidebar__btn">
|
||||
<i class="fas fa-coins" aria-hidden="true"></i>
|
||||
<span><?php echo esc_html(AKSRT_Settings::get_currency_name()); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
/**
|
||||
* Author Hero — shared hero section for author archive and public user homepage.
|
||||
*
|
||||
* Aligns with Zibll zib_author_header(): cover, avatar, name, identity, desc,
|
||||
* and header actions. Content stats live in the tab bar, not a body stats row.
|
||||
*
|
||||
* Contract: get_template_part(..., null, $args)
|
||||
* user WP_User
|
||||
* dashboard array from aksrt_get_user_dashboard_view()
|
||||
* user_home_settings array
|
||||
* is_author_page bool
|
||||
* tab_counts array (optional)
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -18,6 +22,7 @@ $user = $args['user'] ?? null;
|
||||
$dashboard = is_array($args['dashboard'] ?? null) ? $args['dashboard'] : [];
|
||||
$settings = is_array($args['user_home_settings'] ?? null) ? $args['user_home_settings'] : [];
|
||||
$is_author = !empty($args['is_author_page']);
|
||||
$tab_counts = is_array($args['tab_counts'] ?? null) ? $args['tab_counts'] : [];
|
||||
|
||||
if (!($user instanceof WP_User)) {
|
||||
return;
|
||||
@@ -25,12 +30,14 @@ if (!($user instanceof WP_User)) {
|
||||
|
||||
$user_id = (int) $user->ID;
|
||||
$home_url = function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_url($user) : home_url('/');
|
||||
$show_cover = !empty($settings['cover']);
|
||||
$show_follow = !empty($settings['follow']);
|
||||
$show_cover = !array_key_exists('cover', $settings) || !empty($settings['cover']);
|
||||
$show_follow = !array_key_exists('follow', $settings) || !empty($settings['follow']);
|
||||
$show_avatar = !array_key_exists('avatar', $settings) || !empty($settings['avatar']);
|
||||
$show_name = !array_key_exists('name', $settings) || !empty($settings['name']);
|
||||
$show_desc = !array_key_exists('desc', $settings) || !empty($settings['desc']);
|
||||
$show_social = !array_key_exists('social', $settings) || !empty($settings['social']);
|
||||
$show_message = !array_key_exists('message', $settings) || !empty($settings['message']);
|
||||
|
||||
$post_count = (int) ($dashboard['post_count'] ?? 0);
|
||||
$comment_count = (int) ($dashboard['comment_count'] ?? 0);
|
||||
$favorite_count = (int) ($dashboard['favorite_count'] ?? 0);
|
||||
$contacts = $dashboard['user_contacts'] ?? [];
|
||||
$social_on = !empty($dashboard['social_links_on']);
|
||||
$signals = $dashboard['profile_signals'] ?? [];
|
||||
@@ -38,6 +45,17 @@ $notice = $dashboard['profile_notice'] ?? null;
|
||||
$show_report = !empty($dashboard['show_report']);
|
||||
$bg_url = $dashboard['background_url'] ?? '';
|
||||
$is_own = !empty($dashboard['is_own_profile']);
|
||||
|
||||
$follower_count = (int) ($tab_counts['follow'] ?? 0);
|
||||
if ($follower_count <= 0 && class_exists('AKSRT_Follow')) {
|
||||
$follower_count = (int) AKSRT_Follow::get_instance()->get_follower_count($user_id);
|
||||
}
|
||||
|
||||
$pm_enabled = class_exists('AKSRT_Settings') && !empty(AKSRT_Settings::private_message_settings()['enabled']);
|
||||
$messages_url = function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '';
|
||||
$pm_url = ($pm_enabled && $messages_url !== '')
|
||||
? add_query_arg('msg_type', 'conversation', $messages_url)
|
||||
: '';
|
||||
?>
|
||||
|
||||
<div class="aksrt-author-hero<?php echo $show_cover ? '' : ' aksrt-author-hero--no-cover'; ?>">
|
||||
@@ -47,10 +65,19 @@ $is_own = !empty($dashboard['is_own_profile']);
|
||||
src="<?php echo esc_url($bg_url ? $bg_url : get_theme_file_uri('assets/img/person_background.png')); ?>"
|
||||
alt=""<?php echo function_exists('aksrt_lazy_loading') ? aksrt_lazy_loading('cover') : ' loading="lazy"'; ?>>
|
||||
<div class="aksrt-author-hero__cover-mask"></div>
|
||||
<?php if ($follower_count > 0) : ?>
|
||||
<div class="aksrt-author-hero__cover-metas" aria-label="<?php esc_attr_e('主页数据', 'aksrt'); ?>">
|
||||
<span class="aksrt-author-hero__cover-meta" title="<?php esc_attr_e('粉丝', 'aksrt'); ?>">
|
||||
<i class="fas fa-heart" aria-hidden="true"></i>
|
||||
<?php echo esc_html((string) $follower_count); ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="aksrt-author-hero__body">
|
||||
<?php if ($show_avatar) : ?>
|
||||
<div class="aksrt-author-hero__avatar">
|
||||
<?php
|
||||
if (function_exists('aksrt_get_avatar_html')) {
|
||||
@@ -60,8 +87,10 @@ $is_own = !empty($dashboard['is_own_profile']);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="aksrt-author-hero__info">
|
||||
<?php if ($show_name) : ?>
|
||||
<h1 class="aksrt-author-hero__name">
|
||||
<?php echo esc_html($user->display_name); ?>
|
||||
<?php
|
||||
@@ -71,8 +100,9 @@ $is_own = !empty($dashboard['is_own_profile']);
|
||||
}
|
||||
?>
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($user->description) : ?>
|
||||
<?php if ($show_desc && $user->description) : ?>
|
||||
<p class="aksrt-author-hero__desc"><?php echo esc_html($user->description); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -87,22 +117,13 @@ $is_own = !empty($dashboard['is_own_profile']);
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="aksrt-author-hero__stats">
|
||||
<span class="aksrt-author-hero__stat">
|
||||
<strong><?php echo esc_html((string) $post_count); ?></strong>
|
||||
<span><?php esc_html_e('文章', 'aksrt'); ?></span>
|
||||
</span>
|
||||
<span class="aksrt-author-hero__stat">
|
||||
<strong><?php echo esc_html((string) $comment_count); ?></strong>
|
||||
<span><?php esc_html_e('评论', 'aksrt'); ?></span>
|
||||
</span>
|
||||
<span class="aksrt-author-hero__stat">
|
||||
<strong><?php echo esc_html((string) $favorite_count); ?></strong>
|
||||
<span><?php esc_html_e('收藏', 'aksrt'); ?></span>
|
||||
</span>
|
||||
<?php if (!empty($notice) && is_array($notice)) : ?>
|
||||
<div class="aksrt-author-hero__notice aksrt-author-hero__notice--<?php echo esc_attr((string) ($notice['tone'] ?? 'muted')); ?>">
|
||||
<?php echo esc_html((string) ($notice['message'] ?? '')); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($contacts) && $social_on) : ?>
|
||||
<?php if ($show_social && !empty($contacts) && $social_on) : ?>
|
||||
<div class="aksrt-author-hero__contacts">
|
||||
<?php if (function_exists('aksrt_render_social_links')) : ?>
|
||||
<?php aksrt_render_social_links($contacts); ?>
|
||||
@@ -113,11 +134,18 @@ $is_own = !empty($dashboard['is_own_profile']);
|
||||
|
||||
<div class="aksrt-author-hero__actions">
|
||||
<?php if ($is_own) : ?>
|
||||
<a href="<?php echo esc_url(aksrt_get_user_center_url()); ?>" class="btn-ghost btn-sm">
|
||||
<i class="fas fa-cog" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('个人中心', 'aksrt'); ?></span>
|
||||
<a href="<?php echo esc_url(aksrt_get_user_center_url()); ?>" class="btn-primary btn-sm">
|
||||
<i class="fas fa-user" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('用户中心', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php elseif ($show_follow) : ?>
|
||||
<?php if ($show_message && $messages_url !== '') : ?>
|
||||
<a href="<?php echo esc_url($messages_url); ?>" class="btn-ghost btn-sm">
|
||||
<i class="fas fa-bell" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('消息', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php if ($show_follow) : ?>
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<button type="button" class="btn-outline btn-sm aksrt-author-hero__follow-btn" data-aksrt-follow="<?php echo (int) $user_id; ?>" title="<?php esc_attr_e('关注该用户', 'aksrt'); ?>">
|
||||
<i class="far fa-heart" aria-hidden="true"></i>
|
||||
@@ -131,6 +159,21 @@ $is_own = !empty($dashboard['is_own_profile']);
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($show_message && $pm_url !== '') : ?>
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<a href="<?php echo esc_url($pm_url); ?>" class="btn-primary btn-sm">
|
||||
<i class="fas fa-comment" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('私信', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url(aksrt_get_login_url($home_url)); ?>" class="btn-primary btn-sm">
|
||||
<i class="fas fa-comment" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('私信', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($show_report) : ?>
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<button type="button" class="btn-ghost btn-sm aksrt-author-hero__report-btn" data-aksrt-report='{"target_type":"user","target_id":<?php echo (int) $user_id; ?>}' title="<?php esc_attr_e('举报该用户', 'aksrt'); ?>">
|
||||
@@ -147,10 +190,3 @@ $is_own = !empty($dashboard['is_own_profile']);
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($notice)) : ?>
|
||||
<div class="aksrt-author-hero__notice aksrt-author-hero__notice--<?php echo esc_attr($notice['state']); ?>">
|
||||
<i class="fas fa-exclamation-circle" aria-hidden="true"></i>
|
||||
<span><?php echo esc_html($notice['text']); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user