feat(users): govern profiles and access

Normalize fixed profile fields, profile actions, and the five-column capability matrix for comments, uploads, and downloads.
This commit is contained in:
kate522 committed 2026-08-13 00:24:54 +08:00
1 parent 0b06b2c7df
commit 8241570ca2
67 files changed
+780 -1127

No files matched your search

@@ -9,6 +9,7 @@ defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
$profile_details = isset($profile_details) && is_array($profile_details) ? $profile_details : aksrt_get_user_profile_details((int) $user_id);
?>
<form class="profile-form" id="profile-form" method="post">
<?php wp_nonce_field('aksrt_profile_save', '_profile_nonce'); ?>
@@ -24,13 +25,39 @@ extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_
</div>
<div class="widget-card">
<h3 class="widget-title"><?php esc_html_e('个人简介', 'aksrt'); ?></h3>
<h3 class="widget-title"><?php esc_html_e('个人签名', 'aksrt'); ?></h3>
<textarea name="description" id="profile-bio" class="profile-input profile-textarea"
rows="4" maxlength="500" placeholder="<?php esc_attr_e('介绍一下自己…', 'aksrt'); ?>"><?php echo esc_textarea($target_user->description); ?></textarea>
<p class="profile-hint"><?php esc_html_e('显示在你的公开用户主页上,最多 500 字', 'aksrt'); ?></p>
</div>
<?php require __DIR__ . '/form-contacts.php'; ?>
<div class="widget-card">
<h3 class="widget-title"><?php esc_html_e('隐私设置', 'aksrt'); ?></h3>
<select name="privacy" class="profile-input">
<option value="private" <?php selected($profile_details['privacy'], 'private'); ?>><?php esc_html_e('社交资料 所有人不可见', 'aksrt'); ?></option>
<option value="public" <?php selected($profile_details['privacy'], 'public'); ?>><?php esc_html_e('社交资料 所有人可见', 'aksrt'); ?></option>
<option value="members" <?php selected($profile_details['privacy'], 'members'); ?>><?php esc_html_e('社交资料 仅注册用户可见', 'aksrt'); ?></option>
</select>
</div>
<div class="widget-card">
<h3 class="widget-title"><?php esc_html_e('性别', 'aksrt'); ?></h3>
<select name="gender" class="profile-input">
<option value="secret" <?php selected($profile_details['gender'], 'secret'); ?>><?php esc_html_e('保密', 'aksrt'); ?></option>
<option value="male" <?php selected($profile_details['gender'], 'male'); ?>><?php esc_html_e('男', 'aksrt'); ?></option>
<option value="female" <?php selected($profile_details['gender'], 'female'); ?>><?php esc_html_e('女', 'aksrt'); ?></option>
</select>
</div>
<div class="widget-card">
<h3 class="widget-title"><?php esc_html_e('社交资料', 'aksrt'); ?></h3>
<div class="profile-form__fields">
<label><span><?php esc_html_e('个人网站', 'aksrt'); ?></span><input type="url" name="website" class="profile-input" value="<?php echo esc_attr($profile_details['website']); ?>" placeholder="https://"></label>
<label><span>QQ</span><input type="text" name="qq" class="profile-input" maxlength="50" value="<?php echo esc_attr($profile_details['qq']); ?>"></label>
<label><span><?php esc_html_e('微信', 'aksrt'); ?></span><input type="text" name="wechat" class="profile-input" maxlength="100" value="<?php echo esc_attr($profile_details['wechat']); ?>"></label>
<label><span>GitHub</span><input type="url" name="github" class="profile-input" value="<?php echo esc_attr($profile_details['github']); ?>" placeholder="https://github.com/"></label>
</div>
</div>
<div class="profile-form__submit">