用户功能设置收口与废弃后台链路清理

This commit is contained in:
kate522 committed 2026-08-23 22:09:12 +08:00
1 parent 081eb0870d
commit 86692ff3f9
59 files changed
+506 -1767

No files matched your search

+7 -7
View File
@@ -137,11 +137,11 @@ if (!function_exists('aksrt_get_user_center_tab_url')) {
}
}
if (!function_exists('aksrt_normalize_user_center_tabs')) {
if (!function_exists('aksrt_normalize_user_center_panels')) {
/**
* Normalize the dashboard tab contract.
*/
function aksrt_normalize_user_center_tabs(array $tabs): array {
function aksrt_normalize_user_center_panels(array $tabs): array {
$normalized = [];
foreach ($tabs as $key => $tab) {
$key = sanitize_key((string) $key);
@@ -296,7 +296,7 @@ if (!function_exists('aksrt_user_center_resolve_tabs')) {
'favorites' => ['label' => __('我的收藏', 'aksrt'), 'icon' => 'star'],
'settings' => ['label' => __('账号设置', 'aksrt'), 'icon' => 'cog'],
];
$tabs = aksrt_normalize_user_center_tabs($tabs);
$tabs = aksrt_normalize_user_center_panels($tabs);
$keys = array_keys($tabs);
$default = in_array('vip', $keys, true)
? 'vip'
@@ -420,7 +420,7 @@ if (!function_exists('aksrt_user_center_cover_upload_config')) {
'imageId' => 'aksrt-cover-img',
'fieldName' => 'background',
'maxSize' => $max_size,
'fallbackImage' => AKSRT_URI . '/assets/img/person_background.png',
'fallbackImage' => function_exists('aksrt_get_user_cover_url') ? aksrt_get_user_cover_url(get_current_user_id()) : get_theme_file_uri('assets/img/user_t.jpg'),
'idleText' => __('修改背景图', 'aksrt'),
'loadingText' => __('上传中…', 'aksrt'),
'tooLargeText' => sprintf(__('图片大小不能超过 %dMB', 'aksrt'), (int) ($max_size / MB_IN_BYTES)),
@@ -459,9 +459,9 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
$comment_count = (int) ($dashboard['comment_count'] ?? get_comments(['user_id' => $user_id, 'count' => true, 'status' => 'approve']));
$favorite_post_ids = $dashboard['favorite_post_ids'] ?? [];
$favorite_count = (int) ($dashboard['favorite_count'] ?? count($favorite_post_ids));
$user_background_url = (string) ($dashboard['background_url'] ?? get_user_meta($user_id, 'aksrt_background_image', true));
$allow_avatar_upload = function_exists('aksrt_user_can') && aksrt_user_can('upload_avatar', $user_id);
$allow_bg_upload = function_exists('aksrt_user_can') && aksrt_user_can('upload_profile_background', $user_id);
$user_background_url = function_exists('aksrt_get_user_cover_url') ? aksrt_get_user_cover_url($user_id) : '';
$allow_avatar_upload = function_exists('aksrt_is_avatar_upload_enabled') && aksrt_is_avatar_upload_enabled();
$allow_bg_upload = function_exists('aksrt_is_user_cover_upload_enabled') && aksrt_is_user_cover_upload_enabled();
$messages_enabled = !class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::message_enabled();
$follower_count = class_exists('\AKSRT\User\Follow')
? \AKSRT\User\Follow::get_instance()->get_follower_count($user_id)