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

-8
View File
@@ -56,14 +56,6 @@ $need_vip = $gate_code === 'aksrt_need_vip';
$priced = function_exists('aksrt_get_user_pay_price') ? aksrt_get_user_pay_price($post) : null;
$price = is_array($priced) ? (float) ($priced['amount'] ?? 0) : (float) ($pay_meta['price'] ?? 0);
$pay_modo = is_array($priced) ? ((($priced['modo'] ?? '0') === 'points') ? 'points' : '0') : ((($pay_meta['pay_modo'] ?? '0') === 'points') ? 'points' : '0');
$order_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_order_settings() : [];
$free_logged_show = !empty($order_settings['free_logged_show']);
if ($price <= 0 && $free_logged_show && !is_user_logged_in()) {
$can_dl = false;
$need_login = true;
$has_access = true; // free "access" but must login to download
}
$currency = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt');
$cash_symbol = '¥';
if (class_exists('\AKSRT\Settings\Settings')) {
+1 -2
View File
@@ -60,8 +60,7 @@ if ($is_logged_in) {
}
$currency_name = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt');
$paid_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_paid_content_settings() : [];
$dl_requires_login = !empty($paid_settings['download_login']);
$dl_requires_login = function_exists('aksrt_user_can') && !aksrt_user_can('resource_download', get_current_user_id());
?>
<main id="main-content" class="site-main container" tabindex="-1">
+13 -3
View File
@@ -68,9 +68,9 @@ if (file_exists($js)) {
true
);
}
if (!empty($ctx['can_upload_img']) || !empty($ctx['can_cover_image']) || !empty($ctx['can_cover_slide'])) {
wp_enqueue_media();
}
$attachment_settings = class_exists('\\AKSRT\\Settings\\Settings') ? \AKSRT\Settings\Settings::get_all() : [];
$submit_image_max_size = max(1, min(20, (int) ($attachment_settings['submit_image_max_size'] ?? 5))) * MB_IN_BYTES;
$resource_max_size = max(1, min(200, (int) ($attachment_settings['resource_max_size'] ?? 50))) * MB_IN_BYTES;
wp_localize_script('aksrt-front-submit', 'aksrtSubmitData', [
'ajaxUrl' => admin_url('admin-ajax.php'),
@@ -83,6 +83,16 @@ if (file_exists($js)) {
'summary' => !empty($ctx['ai_available']),
'tags' => !empty($ctx['ai_available']),
],
'uploads' => [
'image' => !empty($ctx['can_upload_img']) ? [
'url' => esc_url_raw(rest_url('aksrt/v1/front-submit/upload/image')),
'maxSize' => $submit_image_max_size,
] : null,
'resource' => !empty($ctx['can_upload_file']) ? [
'url' => esc_url_raw(rest_url('aksrt/v1/front-submit/upload/resource')),
'maxSize' => $resource_max_size,
] : null,
],
'i18n' => [
'confirmLeave' => __('你有未保存的更改,确定要离开吗?', 'aksrt'),
'saving' => __('保存中...', 'aksrt'),