fix: improve promotion tabs and referral layout
This commit is contained in:
+6
-9
@@ -55,9 +55,6 @@ class Center {
|
||||
*/
|
||||
public function rest_panel(\WP_REST_Request $request) {
|
||||
$tab = sanitize_key((string) $request->get_param('tab'));
|
||||
if ($tab === 'revenue') {
|
||||
$tab = 'promotion';
|
||||
}
|
||||
$tabs = $this->get_dashboard_tabs();
|
||||
if (!isset($tabs[$tab])) {
|
||||
return new \WP_Error('aksrt_user_center_panel', __('用户中心面板不存在', 'aksrt'), ['status' => 404]);
|
||||
@@ -79,7 +76,7 @@ class Center {
|
||||
$context['creator_income_request'] = $income_request;
|
||||
}
|
||||
$revenue_request = [];
|
||||
if ($tab === 'promotion') {
|
||||
if ($tab === 'revenue') {
|
||||
$reward_tab = sanitize_key((string) $request->get_param('reward_tab'));
|
||||
if (!in_array($reward_tab, ['detail', 'orders', 'users'], true)) {
|
||||
$reward_tab = 'detail';
|
||||
@@ -185,7 +182,7 @@ class Center {
|
||||
'priority' => 50,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'promotion' => [
|
||||
'revenue' => [
|
||||
'label' => __('推广收益', 'aksrt'),
|
||||
'icon' => 'chart-line',
|
||||
'priority' => 55,
|
||||
@@ -221,7 +218,7 @@ class Center {
|
||||
&& !empty(\AKSRT\User\Level::settings()['enabled']);
|
||||
$credits_on = class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::credits_enabled();
|
||||
$balance_on = class_exists('\AKSRT\Credits\Balance') && \AKSRT\Credits\Balance::enabled();
|
||||
$promotion_tab_on = class_exists('\AKSRT\Settings\Settings')
|
||||
$revenue_tab_on = class_exists('\AKSRT\Settings\Settings')
|
||||
&& !empty(\AKSRT\Settings\Settings::get_affiliate_settings()['enabled']);
|
||||
$creator_tab_on = class_exists('\AKSRT\Settings\Settings')
|
||||
&& !empty(\AKSRT\Settings\Settings::get_payment_revenue_settings()['enabled']);
|
||||
@@ -290,7 +287,7 @@ class Center {
|
||||
$order[] = 'credits';
|
||||
}
|
||||
|
||||
if ($promotion_tab_on && !in_array('promotion', $order, true)) {
|
||||
if ($revenue_tab_on && !in_array('revenue', $order, true)) {
|
||||
$insert_at = count($order);
|
||||
foreach (['credits', 'favorites'] as $anchor) {
|
||||
$idx = array_search($anchor, $order, true);
|
||||
@@ -299,7 +296,7 @@ class Center {
|
||||
break;
|
||||
}
|
||||
}
|
||||
array_splice($order, $insert_at, 0, ['promotion']);
|
||||
array_splice($order, $insert_at, 0, ['revenue']);
|
||||
}
|
||||
$auth_on = class_exists('\AKSRT\User\AuthApply')
|
||||
&& !empty(\AKSRT\User\AuthApply::settings()['enabled']);
|
||||
@@ -320,7 +317,7 @@ class Center {
|
||||
if ($key === 'credits' && !$credits_on && !$balance_on) {
|
||||
continue;
|
||||
}
|
||||
if ($key === 'promotion' && !$promotion_tab_on) {
|
||||
if ($key === 'revenue' && !$revenue_tab_on) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user