feat(identity): author card, per-user tip, comment caps, task status
Author card uses configurable limit/orderby/style and self CTAs. Tip is per-user weixin/alipay QR modal (no site-global image). Comment action permissions honor user_caps matrix. Free points tasks expose done_today/passive status + better comment deep link. audit-admin-contracts errors=0.
This commit is contained in:
1 parent
b4d04ae346
commit
8d4e94a02c
10 files changed
+374
-148
No files matched your search
@@ -180,9 +180,12 @@ class AKSRT_Points_Free {
|
||||
* @return list<array{key:string,title:string,desc:string,points:int,enabled:bool}>
|
||||
*/
|
||||
public static function task_list_for_user(int $user_id = 0): array {
|
||||
unset($user_id); // reserved for per-user progress later
|
||||
$cfg = self::settings();
|
||||
$list = [];
|
||||
$login_done = false;
|
||||
if ($user_id > 0) {
|
||||
$login_done = (string) get_user_meta($user_id, self::META_LOGIN, true) === self::today_key();
|
||||
}
|
||||
foreach (self::catalog() as $key => $meta) {
|
||||
$pts = (int) ($cfg['tasks'][$key] ?? 0);
|
||||
// Hide sign_up from daily task list (one-time); still grant on register.
|
||||
@@ -192,12 +195,21 @@ class AKSRT_Points_Free {
|
||||
if ($pts <= 0) {
|
||||
continue;
|
||||
}
|
||||
$status = 'todo';
|
||||
if (in_array($key, ['login', 'sign_in'], true) && $login_done) {
|
||||
$status = 'done_today';
|
||||
} elseif (in_array($key, ['post_like', 'post_favorite', 'followed', 'comment_like', 'bbs_essence', 'bbs_adopt', 'bbs_posts_hot', 'bbs_comment_hot', 'bbs_score_extra'], true)) {
|
||||
$status = 'passive';
|
||||
}
|
||||
$list[] = [
|
||||
'key' => $key,
|
||||
'title' => $meta[0],
|
||||
'desc' => $meta[1],
|
||||
'points' => $pts,
|
||||
'enabled' => true,
|
||||
'key' => $key,
|
||||
'title' => $meta[0],
|
||||
'desc' => $meta[1],
|
||||
'points' => $pts,
|
||||
'enabled' => true,
|
||||
'status' => $status,
|
||||
'progress' => null,
|
||||
'target' => null,
|
||||
];
|
||||
}
|
||||
return $list;
|
||||
|
||||
Reference in new issue
Block a user