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
@@ -106,6 +106,20 @@ $max_pages = (int) ($view['pagination']['max_pages'] ?? 1);
|
||||
</div>
|
||||
|
||||
<div class="aksrt-forum-board__actions">
|
||||
<?php
|
||||
$follow_pay_on = $forum && method_exists($forum, 'is_plate_follow_pay_enabled')
|
||||
? $forum->is_plate_follow_pay_enabled($plate_id)
|
||||
: ((int) get_post_meta($plate_id, '_aksrt_follow_pay', true) === 1);
|
||||
$follow_pay_modo = sanitize_key((string) (get_post_meta($plate_id, '_aksrt_follow_pay_modo', true) ?: 'money'));
|
||||
$allow_guest_plate = $current_user_id <= 0
|
||||
&& $follow_pay_on
|
||||
&& $follow_pay_modo === 'money'
|
||||
&& function_exists('aksrt_allow_guest_forum_pay')
|
||||
&& aksrt_allow_guest_forum_pay(get_post($plate_id));
|
||||
$guest_followed = $current_user_id <= 0
|
||||
&& function_exists('aksrt_guest_has_plate_follow_access')
|
||||
&& aksrt_guest_has_plate_follow_access($plate_id);
|
||||
?>
|
||||
<?php if ($current_user_id > 0) : ?>
|
||||
<button type="button"
|
||||
class="aksrt-forum-board__follow-btn js-aksrt-follow-plate"
|
||||
@@ -114,6 +128,21 @@ $max_pages = (int) ($view['pagination']['max_pages'] ?? 1);
|
||||
<i class="fas fa-heart"></i>
|
||||
<?php echo $is_followed ? esc_html__('已关注', 'aksrt') : esc_html__('关注', 'aksrt'); ?>
|
||||
</button>
|
||||
<?php elseif ($guest_followed) : ?>
|
||||
<button type="button" class="aksrt-forum-board__follow-btn is-followed" disabled>
|
||||
<i class="fas fa-heart"></i>
|
||||
<?php esc_html_e('已关注', 'aksrt'); ?>
|
||||
</button>
|
||||
<?php elseif ($allow_guest_plate) : ?>
|
||||
<button type="button"
|
||||
class="aksrt-forum-board__follow-btn"
|
||||
data-aksrt-pay-plate-follow="<?php echo esc_attr((string) $plate_id); ?>">
|
||||
<i class="fas fa-heart"></i>
|
||||
<?php esc_html_e('付费关注', 'aksrt'); ?>
|
||||
</button>
|
||||
<p class="description" style="margin-top:6px;font-size:12px;">
|
||||
<?php esc_html_e('未登录关注通过 Cookie 生效;建议登录后关注以便保存订单。', 'aksrt'); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($permissions['can_compose'])) : ?>
|
||||
|
||||
Reference in new issue
Block a user