feat(identity): tip QR upload, metrics engine, comment moderate caps
Close identity 1:1 gaps after p1: user-center weixin/alipay tip QR upload+save, AKSRT_User_Metrics counters for medal get_type and level XP bridges, forum/revenue/signin hooks, comment moderate via user_caps, and clearer free-task deep links/status CTAs.
This commit is contained in:
1 parent
4e3eb0414d
commit
487681a6c4
18 files changed
+854
-36
No files matched your search
@@ -52,22 +52,48 @@ $aksrt_points_task_action = static function (string $key): array {
|
||||
'href' => $submit !== '' ? $submit : $home,
|
||||
];
|
||||
case 'comment_new':
|
||||
return [
|
||||
'type' => 'link',
|
||||
'label' => __('去完成', 'aksrt'),
|
||||
'href' => $home,
|
||||
];
|
||||
case 'login':
|
||||
case 'post_like':
|
||||
case 'post_favorite':
|
||||
case 'followed':
|
||||
case 'comment_like':
|
||||
return [
|
||||
'type' => 'link',
|
||||
'label' => __('去看看', 'aksrt'),
|
||||
'href' => $home,
|
||||
];
|
||||
case 'bbs_posts_new':
|
||||
$posts = get_posts(['numberposts' => 1, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC']);
|
||||
$href = $home;
|
||||
if (!empty($posts[0]) && $posts[0] instanceof WP_Post) {
|
||||
$link = get_permalink($posts[0]);
|
||||
if (is_string($link) && $link !== '') {
|
||||
$href = $link . '#comments';
|
||||
}
|
||||
}
|
||||
return [
|
||||
'type' => 'link',
|
||||
'label' => __('去完成', 'aksrt'),
|
||||
'href' => $href,
|
||||
];
|
||||
case 'login':
|
||||
return [
|
||||
'type' => 'none',
|
||||
'label' => __('登录即可领取', 'aksrt'),
|
||||
];
|
||||
case 'post_like':
|
||||
case 'post_favorite':
|
||||
case 'comment_like':
|
||||
$posts = get_posts(['numberposts' => 1, 'post_status' => 'publish', 'orderby' => 'comment_count', 'order' => 'DESC']);
|
||||
$href = $home;
|
||||
if (!empty($posts[0]) && $posts[0] instanceof WP_Post) {
|
||||
$link = get_permalink($posts[0]);
|
||||
if (is_string($link) && $link !== '') {
|
||||
$href = $link;
|
||||
}
|
||||
}
|
||||
return [
|
||||
'type' => 'link',
|
||||
'label' => __('去看看', 'aksrt'),
|
||||
'href' => $href,
|
||||
];
|
||||
case 'followed':
|
||||
$center = function_exists('aksrt_get_user_center_url') ? (string) aksrt_get_user_center_url() : $home;
|
||||
return [
|
||||
'type' => 'link',
|
||||
'label' => __('去主页', 'aksrt'),
|
||||
'href' => $center !== '' ? $center : $home,
|
||||
];
|
||||
case 'bbs_posts_new':
|
||||
case 'bbs_reply':
|
||||
if (!$forum_on) {
|
||||
return ['type' => 'none', 'label' => ''];
|
||||
@@ -180,16 +206,19 @@ $pane = isset($points_tasks_pane) ? sanitize_key((string) $points_tasks_pane)
|
||||
<div class="focus-color em14">
|
||||
<i class="fas fa-coins mr6 em09" aria-hidden="true"></i>+ <?php echo esc_html((string) (int) $task['points']); ?>
|
||||
</div>
|
||||
<?php if (($action['type'] ?? 'none') === 'signin') : ?>
|
||||
<button type="button" class="uc-points-tasks__action muted-color em09 mt6" data-aksrt-signin-goto>
|
||||
<?php echo esc_html((string) $action['label']); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
||||
</button>
|
||||
<?php elseif (($action['type'] ?? 'none') === 'link' && !empty($action['href'])) : ?>
|
||||
<a class="uc-points-tasks__action muted-color em09 mt6" href="<?php echo esc_url((string) $action['href']); ?>">
|
||||
<?php echo esc_html((string) $action['label']); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($done) : ?>
|
||||
<span class="uc-points-tasks__action muted-color em09 mt6"><?php esc_html_e('今日已完成', 'aksrt'); ?></span>
|
||||
<?php elseif (($action['type'] ?? 'none') === 'signin') : ?>
|
||||
<button type="button" class="uc-points-tasks__action muted-color em09 mt6" data-aksrt-signin-goto>
|
||||
<?php echo esc_html((string) $action['label']); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
||||
</button>
|
||||
<?php elseif (($action['type'] ?? 'none') === 'link' && !empty($action['href'])) : ?>
|
||||
<a class="uc-points-tasks__action muted-color em09 mt6" href="<?php echo esc_url((string) $action['href']); ?>">
|
||||
<?php echo esc_html((string) $action['label']); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
||||
</a>
|
||||
<?php elseif (($action['type'] ?? 'none') === 'none' && !empty($action['label'])) : ?>
|
||||
<span class="uc-points-tasks__action muted-color em09 mt6"><?php echo esc_html((string) $action['label']); ?></span>
|
||||
<?php endif; ?> </div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -32,6 +32,56 @@ extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_
|
||||
|
||||
<?php require __DIR__ . '/form-contacts.php'; ?>
|
||||
|
||||
<?php
|
||||
$rewards_on = function_exists('aksrt_rewards_enabled') ? aksrt_rewards_enabled() : false;
|
||||
$rw = (string) get_user_meta((int) $user_id, 'aksrt_rewards_weixin', true);
|
||||
$ra = (string) get_user_meta((int) $user_id, 'aksrt_rewards_alipay', true);
|
||||
$rw_url = '';
|
||||
$ra_url = '';
|
||||
if (function_exists('aksrt_get_user_rewards_img_urls')) {
|
||||
$urls = aksrt_get_user_rewards_img_urls((int) $user_id);
|
||||
$rw_url = (string) ($urls['weixin'] ?? '');
|
||||
$ra_url = (string) ($urls['alipay'] ?? '');
|
||||
}
|
||||
?>
|
||||
<?php if ($rewards_on) : ?>
|
||||
<div class="widget-card">
|
||||
<h3 class="widget-title"><?php esc_html_e('打赏收款码', 'aksrt'); ?></h3>
|
||||
<p class="profile-hint"><?php esc_html_e('上传微信/支付宝收款码后,读者可在文章与作者卡赞赏你。留空则不显示赞赏按钮。', 'aksrt'); ?></p>
|
||||
<div class="aksrt-reward-upload-grid">
|
||||
<div class="aksrt-reward-upload">
|
||||
<label class="aksrt-reward-upload__label"><?php esc_html_e('微信收款码', 'aksrt'); ?></label>
|
||||
<div class="aksrt-reward-upload__preview" data-reward-preview="weixin">
|
||||
<?php if ($rw_url !== '') : ?>
|
||||
<img src="<?php echo esc_url($rw_url); ?>" alt="" />
|
||||
<?php else : ?>
|
||||
<span class="muted-2-color em09"><?php esc_html_e('未上传', 'aksrt'); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<input type="hidden" name="rewards_weixin" id="rewards-weixin" value="<?php echo esc_attr($rw); ?>" />
|
||||
<input type="file" id="rewards-weixin-file" accept="image/*" class="aksrt-reward-upload__file" data-reward-kind="weixin" />
|
||||
<button type="button" class="btn-primary btn-sm" data-reward-upload="weixin"><?php esc_html_e('选择图片', 'aksrt'); ?></button>
|
||||
<button type="button" class="btn-sm" data-reward-clear="weixin"><?php esc_html_e('清除', 'aksrt'); ?></button>
|
||||
</div>
|
||||
<div class="aksrt-reward-upload">
|
||||
<label class="aksrt-reward-upload__label"><?php esc_html_e('支付宝收款码', 'aksrt'); ?></label>
|
||||
<div class="aksrt-reward-upload__preview" data-reward-preview="alipay">
|
||||
<?php if ($ra_url !== '') : ?>
|
||||
<img src="<?php echo esc_url($ra_url); ?>" alt="" />
|
||||
<?php else : ?>
|
||||
<span class="muted-2-color em09"><?php esc_html_e('未上传', 'aksrt'); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<input type="hidden" name="rewards_alipay" id="rewards-alipay" value="<?php echo esc_attr($ra); ?>" />
|
||||
<input type="file" id="rewards-alipay-file" accept="image/*" class="aksrt-reward-upload__file" data-reward-kind="alipay" />
|
||||
<button type="button" class="btn-primary btn-sm" data-reward-upload="alipay"><?php esc_html_e('选择图片', 'aksrt'); ?></button>
|
||||
<button type="button" class="btn-sm" data-reward-clear="alipay"><?php esc_html_e('清除', 'aksrt'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class="profile-form__submit">
|
||||
<button type="submit" class="btn-primary btn-lg" id="profile-save-btn">
|
||||
<?php esc_html_e('保存修改', 'aksrt'); ?>
|
||||
|
||||
Reference in new issue
Block a user