fix(users): keep management inside center
This commit is contained in:
+22
-4
@@ -141,6 +141,18 @@ class Center {
|
||||
'priority' => 18,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'posts' => [
|
||||
'label' => __('文章', 'aksrt'),
|
||||
'icon' => 'file-alt',
|
||||
'priority' => 20,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'follow' => [
|
||||
'label' => __('粉丝', 'aksrt'),
|
||||
'icon' => 'users',
|
||||
'priority' => 25,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'comments' => [
|
||||
'label' => __('我的评论', 'aksrt'),
|
||||
'icon' => 'comment',
|
||||
@@ -200,10 +212,7 @@ class Center {
|
||||
];
|
||||
|
||||
$this->panels = [];
|
||||
$configured = array_values(array_filter(
|
||||
array_map('sanitize_key', (array) ($settings['tabs'] ?? [])),
|
||||
static fn(string $key): bool => $key !== 'posts'
|
||||
));
|
||||
$configured = array_values(array_map('sanitize_key', (array) ($settings['tabs'] ?? [])));
|
||||
if ($configured === []) {
|
||||
$configured = ['profile', 'comments', 'favorites'];
|
||||
}
|
||||
@@ -232,6 +241,15 @@ class Center {
|
||||
$order = array_values(array_filter($order, static fn(string $key): bool => $key !== 'creator'));
|
||||
}
|
||||
|
||||
if (!in_array('posts', $order, true)) {
|
||||
$insert_at = array_search('creator', $order, true);
|
||||
array_splice($order, $insert_at === false ? 0 : (int) $insert_at + 1, 0, ['posts']);
|
||||
}
|
||||
if (!in_array('follow', $order, true)) {
|
||||
$insert_at = array_search('posts', $order, true);
|
||||
array_splice($order, $insert_at === false ? count($order) : (int) $insert_at + 1, 0, ['follow']);
|
||||
}
|
||||
|
||||
// Growth level is a dedicated user-center surface, separate from spendable points.
|
||||
if ($level_on && !in_array('level', $order, true)) {
|
||||
$insert_at = array_search('profile', $order, true);
|
||||
|
||||
Reference in New Issue
Block a user