feat(admin,forum): download logs, hidecontent, VIP tiers, users commerce

Add aksrt_download_logs workbench, zibll hidecontent alias + topic
partial-hide path, VIP1/VIP2 price matrix for topics, and users list
commerce snapshot column with deep links.
This commit is contained in:
2026-07-15 11:13:48 +08:00
parent cf6ad0e972
commit 8d31e65ccd
14 changed files with 611 additions and 32 deletions
+77
View File
@@ -59,6 +59,83 @@ if (empty($topic['can_view'])) :
$deny_vis = $topic['visibility']['key'] ?? '';
$credits_cost = (int) get_post_meta($topic_id, '_aksrt_credits_cost', true);
$pay_price = get_post_meta($topic_id, '_aksrt_pay_price', true);
$pay_hide_part = !empty($topic['pay_hide_part']) || ((int) get_post_meta($topic_id, '_aksrt_pay_hide_part', true) === 1);
$partial_ok = $pay_hide_part && in_array($deny_vis, ['pay', 'credits'], true);
// Partial hide: show title + body with payshow/hidecontent locked blocks + pay CTA.
if ($partial_ok) :
?>
<main id="main-content" class="site-main content-shell content-shell--stream content-shell--forum" tabindex="-1">
<div class="content-wrap container">
<div class="content-layout content-layout--no-sidebar">
<div class="content-layout__primary">
<div class="aksrt-forum-topic">
<header class="aksrt-forum-topic__header">
<h1 class="aksrt-forum-topic__title"><?php echo esc_html((string) ($topic['title'] ?? get_the_title($topic_id))); ?></h1>
</header>
<div class="aksrt-forum-topic__denied aksrt-forum-topic__denied--partial">
<i class="fas fa-lock"></i>
<p><?php esc_html_e('部分内容需解锁后查看。', 'aksrt'); ?></p>
<?php if ($deny_vis === 'credits' && $credits_cost > 0 && is_user_logged_in()) : ?>
<button type="button" class="aksrt-forum-topic__primary-btn js-aksrt-unlock-topic"
data-topic-id="<?php echo esc_attr((string) $topic_id); ?>"
data-cost="<?php echo esc_attr((string) $credits_cost); ?>">
<i class="fas fa-unlock"></i> <?php printf(esc_html__('使用 %d 积分解锁', 'aksrt'), $credits_cost); ?>
</button>
<span class="aksrt-forum-topic__unlock-feedback js-aksrt-action-feedback" aria-live="polite"></span>
<?php elseif ($deny_vis === 'pay' && is_user_logged_in()) : ?>
<?php
$charge_amount = (float) $pay_price;
$vip_price_raw = get_post_meta($topic_id, '_aksrt_pay_vip_price', true);
$vip_set = ($vip_price_raw !== '' && $vip_price_raw !== null && $vip_price_raw !== false);
$viewer_id = get_current_user_id();
$is_vip_user = $viewer_id > 0 && function_exists('aksrt_is_vip') && aksrt_is_vip($viewer_id);
$is_free_vip = false;
if ($is_vip_user && $vip_set) {
$charge_amount = max(0.0, (float) $vip_price_raw);
$is_free_vip = $charge_amount <= 0;
}
?>
<button type="button" class="aksrt-forum-topic__primary-btn js-aksrt-purchase-topic"
data-topic-id="<?php echo esc_attr((string) $topic_id); ?>"
data-price="<?php echo esc_attr(number_format($charge_amount, 2, '.', '')); ?>"
data-free="<?php echo $is_free_vip ? '1' : '0'; ?>">
<i class="fas fa-shopping-cart"></i>
<?php
if ($is_free_vip) {
esc_html_e('VIP 免费解锁', 'aksrt');
} else {
printf(esc_html__('余额支付 ¥%s', 'aksrt'), esc_html(number_format($charge_amount, 2, '.', '')));
}
?>
</button>
<span class="aksrt-forum-topic__unlock-feedback js-aksrt-action-feedback" aria-live="polite"></span>
<?php elseif (!is_user_logged_in()) : ?>
<a href="<?php echo esc_url(wp_login_url(get_permalink($topic_id))); ?>" class="aksrt-forum-topic__primary-btn"><?php esc_html_e('登录后解锁', 'aksrt'); ?></a>
<?php endif; ?>
</div>
<article class="aksrt-forum-topic__content aksrt-forum-topic__content--partial">
<?php
// Render WP content so payshow/hidecontent shortcodes run for locked parts.
if (have_posts()) {
while (have_posts()) {
the_post();
the_content();
}
} else {
echo apply_filters('the_content', (string) ($topic['content'] ?? '')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</article>
</div>
</div>
</div>
</div>
</main>
<?php
get_footer();
return;
endif;
?>
<main id="main-content" class="site-main content-shell content-shell--stream content-shell--forum" tabindex="-1">
<div class="content-wrap container">