diff --git a/assets/css/frontend/messages.css b/assets/css/frontend/messages.css
index f05eba2b..336915a9 100644
--- a/assets/css/frontend/messages.css
+++ b/assets/css/frontend/messages.css
@@ -578,3 +578,42 @@ html.dark .aksrt-pm__item.is-unread,
html.dark .aksrt-pm__item.is-unread {
background: rgba(240, 68, 148, 0.08);
}
+
+
+/* Page header */
+.messages-center__header {
+ margin: 8px 0 16px;
+}
+.messages-center__title {
+ margin: 0 0 6px;
+ font-size: 22px;
+ font-weight: 700;
+ color: var(--color-ink, #1f2937);
+}
+.messages-center__subtitle {
+ margin: 0;
+ font-size: 14px;
+ color: var(--color-ink-3, #6b7280);
+}
+
+.messages-center--disabled {
+ display: block;
+ min-height: 40vh;
+}
+
+/* PM thread uses hidden attribute instead of inline style */
+.aksrt-pm__thread[hidden] {
+ display: none !important;
+}
+
+.message-item__new-badge {
+ display: inline-block;
+ margin-left: 6px;
+ padding: 1px 6px;
+ border-radius: 999px;
+ background: var(--color-primary, #3b82f6);
+ color: #fff;
+ font-size: 11px;
+ font-weight: 600;
+ vertical-align: middle;
+}
diff --git a/assets/js/conversation.js b/assets/js/conversation.js
index dc939d11..4508d376 100644
--- a/assets/js/conversation.js
+++ b/assets/js/conversation.js
@@ -58,7 +58,7 @@
// Back button
if (backBtn) {
backBtn.addEventListener('click', function () {
- threadView.style.display = 'none';
+ threadView.hidden = true;
listView.style.display = '';
});
}
@@ -99,7 +99,7 @@
}).then(function (d) {
if (d.success && d.data) {
renderMessages(d.data.messages || []);
- listView.style.display = 'none';
+ listView.hidden = true;
threadView.style.display = '';
// Mark as read
diff --git a/inc/classes/scripts-traits/trait-aksrt-scripts-part-1b.php b/inc/classes/scripts-traits/trait-aksrt-scripts-part-1b.php
index 6de49d00..9f45e527 100644
--- a/inc/classes/scripts-traits/trait-aksrt-scripts-part-1b.php
+++ b/inc/classes/scripts-traits/trait-aksrt-scripts-part-1b.php
@@ -341,6 +341,39 @@ trait AKSRT_Scripts_Part_1b {
);
}
+ // 消息中心页
+ if (is_page_template('templates/pages/page-messages.php')) {
+ $messages_css = get_template_directory() . '/assets/css/frontend/messages.css';
+ if (file_exists($messages_css)) {
+ wp_enqueue_style(
+ 'aksrt-messages',
+ $base_uri . '/assets/css/frontend/messages.css',
+ ['aksrt-tokens'],
+ (string) filemtime($messages_css)
+ );
+ }
+ $messages_js = get_template_directory() . '/assets/js/messages.js';
+ if (file_exists($messages_js)) {
+ wp_enqueue_script(
+ 'aksrt-messages',
+ $base_uri . '/assets/js/messages.js',
+ ['aksrt-script'],
+ (string) filemtime($messages_js),
+ true
+ );
+ }
+ $conversation_js = get_template_directory() . '/assets/js/conversation.js';
+ if (file_exists($conversation_js)) {
+ wp_enqueue_script(
+ 'aksrt-conversation',
+ $base_uri . '/assets/js/conversation.js',
+ ['aksrt-script'],
+ (string) filemtime($conversation_js),
+ true
+ );
+ }
+ }
+
// Forum pages (home / plate / board tax / tag / topic / compose / plate-cat)
$is_forum_surface = is_page_template('templates/pages/page-forums.php')
|| is_page_template('templates/forum/forum-compose.php')
diff --git a/templates/pages/page-messages.php b/templates/pages/page-messages.php
index d066f5ca..a0b04531 100644
--- a/templates/pages/page-messages.php
+++ b/templates/pages/page-messages.php
@@ -4,6 +4,7 @@
* Template Post Type: page
*
* 独立消息中心页面 — 两栏布局(左侧导航 + 右侧消息列表)
+ * 对齐 Zibll msg-center:未读 / 评论 / 系统 / 私信(可开关)
*
* @package AKSRT
*/
@@ -12,225 +13,311 @@ defined('ABSPATH') || exit;
get_header();
-if ( ! is_user_logged_in() ) {
- $login_url = function_exists( 'aksrt_get_login_url' ) ? aksrt_get_login_url() : wp_login_url( get_permalink() );
- wp_safe_redirect( $login_url );
+if (!is_user_logged_in()) {
+ $login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url(get_permalink());
+ wp_safe_redirect($login_url);
exit;
}
+$messages_enabled = !class_exists('AKSRT_Settings') || AKSRT_Settings::message_enabled();
+$pm_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::private_message_settings() : ['enabled' => false];
+$pm_enabled = !empty($pm_settings['enabled']);
+
+if (!$messages_enabled) :
+ ?>
+
+
+
+ empty( $n['read'] ) );
-} elseif ( $current_type !== 'all' ) {
- $filtered = array_filter( $filtered, static fn( $n ) => ( $n['type'] ?? '' ) === $current_type );
+// 类型分组:对齐 Zibll 主 tab 语义,同时兼容历史 type 键。
+$type_groups = [
+ 'unread' => null, // special: !read
+ 'all' => null, // special: all
+ 'comment' => ['comment_reply', 'comment_approved', 'pending_comments'],
+ 'credits' => ['credits_added', 'credits_deducted'],
+ 'system' => ['notice', 'download_ready', 'upload_moderation', 'verify_email'],
+ 'conversation' => ['conversation'],
+];
+
+if ($current_type === 'conversation' && !$pm_enabled) {
+ $current_type = 'unread';
}
-$filtered = array_values( $filtered );
-// 分页
+$allowed_types = array_keys($type_groups);
+if (!in_array($current_type, $allowed_types, true)) {
+ // 兼容旧 URL:msg_type=comment_reply 等
+ $mapped = 'all';
+ foreach ($type_groups as $group => $types) {
+ if (is_array($types) && in_array($current_type, $types, true)) {
+ $mapped = $group;
+ break;
+ }
+ }
+ $current_type = $mapped;
+}
+
+$filtered = $all_notifications;
+if ($current_type === 'unread') {
+ $filtered = array_filter($filtered, static fn($n) => empty($n['read']));
+} elseif ($current_type !== 'all' && $current_type !== 'conversation') {
+ $types = $type_groups[$current_type] ?? [];
+ $filtered = array_filter($filtered, static function ($n) use ($types) {
+ $t = (string) ($n['type'] ?? 'notice');
+ return in_array($t, $types, true);
+ });
+}
+$filtered = array_values($filtered);
+
$per_page = 20;
-$current_page = max( 1, (int) ( $_GET['msg_page'] ?? 1 ) );
-$total = count( $filtered );
-$total_pages = max( 1, (int) ceil( $total / $per_page ) );
-$offset = ( $current_page - 1 ) * $per_page;
-$paged_items = array_slice( $filtered, $offset, $per_page );
+$current_page = max(1, (int) ($_GET['msg_page'] ?? 1));
+$total = count($filtered);
+$total_pages = max(1, (int) ceil($total / $per_page));
+$offset = ($current_page - 1) * $per_page;
+$paged_items = array_slice($filtered, $offset, $per_page);
-// 统计各类型数量
-$type_counts = [ 'all' => count( $all_notifications ), 'unread' => 0 ];
-foreach ( $all_notifications as $n ) {
- $t = $n['type'] ?? 'notice';
- $type_counts[ $t ] = ( $type_counts[ $t ] ?? 0 ) + 1;
- if ( empty( $n['read'] ) ) {
+// 统计
+$type_counts = [
+ 'all' => count($all_notifications),
+ 'unread' => 0,
+ 'comment'=> 0,
+ 'credits'=> 0,
+ 'system' => 0,
+ 'conversation' => 0,
+];
+foreach ($all_notifications as $n) {
+ $t = (string) ($n['type'] ?? 'notice');
+ if (empty($n['read'])) {
$type_counts['unread']++;
}
+ foreach (['comment', 'credits', 'system', 'conversation'] as $group) {
+ if (in_array($t, $type_groups[$group], true)) {
+ $type_counts[$group]++;
+ }
+ }
+}
+
+if ($pm_enabled && class_exists('AKSRT_Private_Message')) {
+ // conversation count prefers live PM conversations when available
+ $pm_tmp = AKSRT_Private_Message::get_instance();
+ if (method_exists($pm_tmp, 'get_conversations')) {
+ $convs = $pm_tmp->get_conversations($user_id, 100);
+ if (is_array($convs)) {
+ $type_counts['conversation'] = count($convs);
+ }
+ }
}
-// 导航定义
$nav_items = [
- 'all' => __( '全部消息', 'aksrt' ),
- 'unread' => __( '未读', 'aksrt' ),
- 'conversation' => __( '私信', 'aksrt' ),
- 'comment_reply' => __( '评论回复', 'aksrt' ),
- 'comment_approved' => __( '评论审核', 'aksrt' ),
- 'credits_added' => __( '积分增加', 'aksrt' ),
- 'credits_deducted' => __( '积分扣减', 'aksrt' ),
- 'download_ready' => __( '下载就绪', 'aksrt' ),
- 'upload_moderation'=> __( '图片审核', 'aksrt' ),
- 'notice' => __( '系统通知', 'aksrt' ),
+ 'unread' => __('未读消息', 'aksrt'),
+ 'all' => __('全部消息', 'aksrt'),
+ 'comment' => __('评论互动', 'aksrt'),
+ 'credits' => __('积分动态', 'aksrt'),
+ 'system' => __('系统通知', 'aksrt'),
+];
+if ($pm_enabled) {
+ $nav_items['conversation'] = __('私信消息', 'aksrt');
+}
+
+$icon_map = [
+ 'comment_reply' => 'fas fa-comment-dots',
+ 'comment_approved' => 'fas fa-check-circle',
+ 'credits_added' => 'fas fa-coins',
+ 'credits_deducted' => 'fas fa-coins',
+ 'download_ready' => 'fas fa-download',
+ 'upload_moderation' => 'fas fa-image',
+ 'verify_email' => 'fas fa-envelope-open-text',
+ 'pending_comments' => 'fas fa-clock',
+ 'conversation' => 'fas fa-envelope',
+ 'notice' => 'fas fa-bell',
];
-// 图标映射
-$icon_map = [
- 'comment_reply' => 'fas fa-comment-dots',
- 'comment_approved' => 'fas fa-check-circle',
- 'credits_added' => 'fas fa-coins',
- 'credits_deducted' => 'fas fa-coins',
- 'download_ready' => 'fas fa-download',
- 'upload_moderation'=> 'fas fa-image',
- 'verify_email' => 'fas fa-envelope-open-text',
- 'pending_comments' => 'fas fa-clock',
- 'conversation' => 'fas fa-envelope',
- 'notice' => 'fas fa-bell',
-];
+$messages_base = function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : get_permalink();
+if (!$messages_base) {
+ $messages_base = get_permalink();
+}
?>
-
-
+
+
-
- get_conversations( $user_id, 30 ) : [];
- $pm_nonce = wp_create_nonce( 'aksrt_pm' );
- ?>
-
-
-
-
-
-
; ?>)
/>
-
-
-
- 0 ) : ?>
-
+
+
+
+
+
+
+
+ get_conversations($user_id, 30) : [];
+ $pm_nonce = wp_create_nonce('aksrt_pm');
+ $pm_placeholder = (string) ($pm_settings['placeholder'] ?? __('请输入消息...', 'aksrt'));
+ $pm_submit = (string) ($pm_settings['submit_text'] ?? __('发送', 'aksrt'));
+ ?>
+
+
+
+
+
+
 ($conv['other_avatar'] ?? '')); ?>)
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1) : ?>
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- NEW
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1 ) : ?>
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/templates/parts/single-author-bar.php b/templates/parts/single-author-bar.php
index 8a7504e5..88e85815 100644
--- a/templates/parts/single-author-bar.php
+++ b/templates/parts/single-author-bar.php
@@ -63,9 +63,12 @@ $classes = trim('article-avatar ' . $extra_class . ($show_actions ? ' article-av
-
-
-
+
+