diff --git a/inc/helpers/user-center-renderers/sidebar-nav.php b/inc/helpers/user-center-renderers/sidebar-nav.php index d36433a6..c40a5959 100644 --- a/inc/helpers/user-center-renderers/sidebar-nav.php +++ b/inc/helpers/user-center-renderers/sidebar-nav.php @@ -10,11 +10,31 @@ defined('ABSPATH') || exit; $level_url = isset($dashboard_tabs['level']) ? aksrt_get_user_center_tab_url('level') : ''; +$promotion_url = isset($dashboard_tabs['promotion']) + ? aksrt_get_user_center_tab_url('promotion') + : ''; +$revenue_url = isset($dashboard_tabs['revenue']) + ? aksrt_get_user_center_tab_url('revenue') + : ''; $auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : ''; $orders_available = isset($dashboard_tabs['orders']); $orders_url = $orders_available ? (string) ($orders_url ?? '') : ''; $services = array_values(array_filter([ + [ + 'label' => __('推广中心', 'aksrt'), + 'icon' => 'share-alt', + 'tone' => 'promotion', + 'url' => $promotion_url, + 'tab' => 'promotion', + ], + [ + 'label' => __('收益中心', 'aksrt'), + 'icon' => 'chart-line', + 'tone' => 'revenue', + 'url' => $revenue_url, + 'tab' => 'revenue', + ], [ 'label' => __('我的等级', 'aksrt'), 'icon' => 'chart-line', diff --git a/inc/modules/user-parts/urls.php b/inc/modules/user-parts/urls.php index 3f589964..f6b42bc8 100644 --- a/inc/modules/user-parts/urls.php +++ b/inc/modules/user-parts/urls.php @@ -20,7 +20,7 @@ if (!function_exists('aksrt_get_user_center_url')) : */ function aksrt_get_user_center_url(string $tab = ''): string { $tab = sanitize_key($tab ?: 'vip'); - $aliases = ['assets' => 'credits', 'signin' => 'credits', 'invite' => 'revenue', 'promotion' => 'revenue']; + $aliases = ['assets' => 'credits', 'signin' => 'credits', 'invite' => 'promotion', 'promotion' => 'promotion']; $tab = $aliases[$tab] ?? $tab; $path_tab = $tab === 'credits' ? 'balance' : $tab; return get_option('permalink_structure') diff --git a/src/Core/ScriptsPart1b.php b/src/Core/ScriptsPart1b.php index af879a32..7ae2f0fd 100644 --- a/src/Core/ScriptsPart1b.php +++ b/src/Core/ScriptsPart1b.php @@ -218,8 +218,11 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js'; $balance_on = is_user_logged_in() && class_exists('\AKSRT\Credits\Balance') && \AKSRT\Credits\Balance::enabled(); + $affiliate_on = is_user_logged_in() + && class_exists('\\AKSRT\\Settings\\Settings') + && !empty(\AKSRT\Settings\Settings::get_affiliate_settings()['enabled']); $vip_coordinator = get_template_directory() . '/assets/js/vip-purchase-coordinator.js'; - if (($vip_on || $credits_on) && file_exists($vip_coordinator)) { + if (($vip_on || $credits_on || $affiliate_on) && file_exists($vip_coordinator)) { wp_enqueue_script( 'aksrt-vip-coordinator', $base_uri . '/assets/js/vip-purchase-coordinator.js', @@ -821,7 +824,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js'; } // 积分相关:已登录 + 启用积分功能时全站加载 - if ($credits_on || $balance_on) { + if ($credits_on || $balance_on || $affiliate_on) { $enqueue_module('credits'); // profile 页:加载 credits.js(签到 + 邀请 + 提现交互)