feat(forum): guest cash purchase for topic and plate follow
- Reuse pay_no_logged_in / pay_cookie_day; generalized guest cookie helpers - Topic + plate cash: guest preview/purchase (no balance), order.user_id=0, cookie unlock - View gates: can_view_topic pay + plate follow accept signed guest cookies - Templates: guest buy/follow CTAs; poll endpoint allows plate_follow guest orders
This commit is contained in:
1 parent
a9150862ef
commit
6b6314b033
9 files changed
+274
-70
No files matched your search
@@ -192,7 +192,12 @@ if (empty($topic['can_view'])) :
|
||||
<?php elseif ($charge_amount > 0 || $base_amount > 0) : ?>
|
||||
<span class="aksrt-forum-topic__pay-price"><?php printf(esc_html__('价格:¥%s', 'aksrt'), esc_html(number_format(max($charge_amount, $base_amount), 2, '.', ''))); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if (!is_user_logged_in()) : ?>
|
||||
<?php
|
||||
$allow_guest_topic = !is_user_logged_in()
|
||||
&& function_exists('aksrt_allow_guest_forum_pay')
|
||||
&& aksrt_allow_guest_forum_pay(get_post($topic_id));
|
||||
?>
|
||||
<?php if (!is_user_logged_in() && !$allow_guest_topic) : ?>
|
||||
<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 else : ?>
|
||||
<button type="button" class="aksrt-forum-topic__primary-btn"
|
||||
@@ -201,13 +206,19 @@ if (empty($topic['can_view'])) :
|
||||
data-free="<?php echo $is_free_vip ? '1' : '0'; ?>">
|
||||
<i class="fas fa-shopping-cart"></i>
|
||||
<?php
|
||||
if ($is_free_vip) {
|
||||
if ($is_free_vip && is_user_logged_in()) {
|
||||
esc_html_e('VIP 免费解锁', 'aksrt');
|
||||
} else {
|
||||
printf(esc_html__('购买解锁 ¥%s', 'aksrt'), esc_html(number_format($charge_amount, 2, '.', '')));
|
||||
printf(esc_html__('购买解锁 ¥%s', 'aksrt'), esc_html(number_format(max($charge_amount, $base_amount), 2, '.', '')));
|
||||
}
|
||||
?>
|
||||
</button>
|
||||
<?php if ($allow_guest_topic) : ?>
|
||||
<p class="description" style="margin-top:8px;">
|
||||
<?php esc_html_e('未登录购买将通过浏览器 Cookie 解锁;建议登录后购买以便保存订单。', 'aksrt'); ?>
|
||||
<a href="<?php echo esc_url(wp_login_url(get_permalink($topic_id))); ?>"><?php esc_html_e('去登录', 'aksrt'); ?></a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<span class="aksrt-forum-topic__unlock-feedback js-aksrt-action-feedback" aria-live="polite"></span>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
|
||||
Reference in new issue
Block a user