empty( $n['read'] ) ); } elseif ( $current_type !== 'all' ) { $filtered = array_filter( $filtered, static fn( $n ) => ( $n['type'] ?? '' ) === $current_type ); } $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 ); // 统计各类型数量 $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['unread']++; } } // 导航定义 $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' ), ]; // 图标映射 $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', ]; ?>
get_conversations( $user_id, 30 ) : []; $pm_nonce = wp_create_nonce( 'aksrt_pm' ); ?>
/>
0 ) : ?>

NEW
1 ) : ?>
$current_type, 'msg_page' => $i ] ); ?>