feat(user-center): promote invite into standalone 推广中心 tab

Register a dedicated `promotion` dashboard panel gated by the existing
invite switches (credits + invite reward + invite registration), and move
the invite card out of the revenue tab so 收益中心 is pure earnings/withdrawal.

- src/User/Center.php: register promotion panel; revenue no longer depends
  on invite being on
- inc/helpers/user-center-renderers/profile-promotion.php: new panel body
  hosting the existing [data-aksrt-invite] card
- profile-revenue.php: drop the invite section; aksrt-user-center.php: drop
  unused show_invite_section context, add promotion to built-in tabs + view map
- repoint invite/promotion deep-link aliases from revenue to promotion across
  tab-url builder, tab resolver, runtime tabAliases, urls.php, and the
  revenue-JS enqueue gate
- sidebar-nav.php: add 推广中心 service entry; shell.css: entry icon color;
  sidebar-creator.php: reword revenue card
- UserRuntime.php: allow promotion in configurable tabs
This commit is contained in:
2026-08-05 16:45:47 +08:00
parent 644bafb35c
commit 51274fd00a
10 changed files with 69 additions and 21 deletions
+1 -1
View File
@@ -700,7 +700,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|| (
(function_exists('aksrt_is_user_center_page') && aksrt_is_user_center_page())
&& isset($_GET['tab'])
&& in_array(sanitize_key((string) wp_unslash($_GET['tab'])), ['revenue', 'invite', 'promotion'], true)
&& 'revenue' === sanitize_key((string) wp_unslash($_GET['tab']))
);
if ($is_revenue_surface) {
$revenue_js = get_template_directory() . '/assets/js/revenue.js';
+1 -1
View File
@@ -90,7 +90,7 @@ class UserRuntime {
// Built-in switchable panels. VIP is always auto-injected when enabled
// by AKSRT\User\Center — keep it allowed for explicit config too.
$allowed_tabs = ['profile', 'level', 'posts', 'comments', 'favorites', 'credits', 'revenue', 'vip', 'orders', 'auth', 'settings'];
$allowed_tabs = ['profile', 'level', 'posts', 'comments', 'favorites', 'credits', 'promotion', 'revenue', 'vip', 'orders', 'auth', 'settings'];
$normalized_tabs = ['profile'];
foreach ((array) $tabs as $tab) {
+24 -3
View File
@@ -91,6 +91,12 @@ class Center {
'priority' => 50,
'type' => 'panel',
],
'promotion' => [
'label' => __('推广中心', 'aksrt'),
'icon' => 'bullhorn',
'priority' => 52,
'type' => 'panel',
],
'revenue' => [
'label' => __('收益中心', 'aksrt'),
'icon' => 'chart-line',
@@ -131,12 +137,13 @@ class Center {
&& class_exists('\AKSRT\Settings\Settings')
&& \AKSRT\Settings\Settings::invite_enabled()
&& \AKSRT\Settings\Settings::invite_registration_enabled();
$revenue_on = class_exists('\AKSRT\Settings\Settings')
// Promotion (invite) center is its own tab; revenue stays pure earnings/withdrawal.
$promotion_on = $invite_on;
$revenue_tab_on = class_exists('\AKSRT\Settings\Settings')
&& (
!empty(\AKSRT\Settings\Settings::get_payment_revenue_settings()['enabled'])
|| !empty(\AKSRT\Settings\Settings::get_payment_affiliate_settings()['enabled'])
);
$revenue_tab_on = $revenue_on || $invite_on;
$vip_on = class_exists('\AKSRT\Settings\Settings')
&& !empty(\AKSRT\Settings\Settings::get_payment_vip_settings()['enabled']);
@@ -183,7 +190,7 @@ class Center {
if (($credits_on || $balance_on) && !in_array('credits', $order, true)) {
$order[] = 'credits';
}
if ($revenue_tab_on && !in_array('revenue', $order, true)) {
if ($promotion_on && !in_array('promotion', $order, true)) {
$insert_at = count($order);
foreach (['credits', 'favorites', 'posts'] as $anchor) {
$idx = array_search($anchor, $order, true);
@@ -192,6 +199,17 @@ class Center {
break;
}
}
array_splice($order, $insert_at, 0, ['promotion']);
}
if ($revenue_tab_on && !in_array('revenue', $order, true)) {
$insert_at = count($order);
foreach (['promotion', 'credits', 'favorites', 'posts'] as $anchor) {
$idx = array_search($anchor, $order, true);
if ($idx !== false) {
$insert_at = (int) $idx + 1;
break;
}
}
array_splice($order, $insert_at, 0, ['revenue']);
}
$auth_on = class_exists('\AKSRT\User\AuthApply')
@@ -216,6 +234,9 @@ class Center {
if ($key === 'revenue' && !$revenue_tab_on) {
continue;
}
if ($key === 'promotion' && !$promotion_on) {
continue;
}
if ($key === 'vip' && !$vip_on) {
continue;
}