fix(users): keep management inside center
This commit is contained in:
1 parent
c3bfd12c69
commit
ce2b266890
44 files changed
+194
-2584
No files matched your search
@@ -16,8 +16,6 @@ add_filter('query_vars', function ($vars) {
|
||||
$vars[] = 'aksrt_user_center';
|
||||
$vars[] = 'aksrt_user_center_tab';
|
||||
$vars[] = 'aksrt_author_identifier';
|
||||
$vars[] = 'aksrt_orders';
|
||||
$vars[] = 'aksrt_revenue';
|
||||
return $vars;
|
||||
});
|
||||
|
||||
@@ -57,7 +55,7 @@ add_action('template_redirect', function () {
|
||||
$tab = $tab === 'balance' ? 'credits' : sanitize_key($tab);
|
||||
$allowed = class_exists('\\AKSRT\\User\\Center')
|
||||
? array_keys(\AKSRT\User\Center::get_instance()->get_dashboard_tabs())
|
||||
: ['profile', 'level', 'creator', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'revenue', 'settings'];
|
||||
: ['profile', 'level', 'creator', 'posts', 'follow', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'revenue', 'settings'];
|
||||
if (!in_array($tab, $allowed, true)) {
|
||||
global $wp_query;
|
||||
if ($wp_query instanceof WP_Query) { $wp_query->set_404(); }
|
||||
@@ -70,13 +68,8 @@ add_action('init', function () {
|
||||
add_rewrite_tag('%aksrt_user_center%', '([^&]+)');
|
||||
add_rewrite_tag('%aksrt_user_center_tab%', '([^/]+)');
|
||||
add_rewrite_tag('%aksrt_author_identifier%', '([^/]+)');
|
||||
add_rewrite_tag('%aksrt_orders%', '([0-1])');
|
||||
add_rewrite_tag('%aksrt_revenue%', '([0-1])');
|
||||
add_rewrite_rule('^user/([a-z0-9_-]+)/?$', 'index.php?aksrt_user_center=1&aksrt_user_center_tab=$matches[1]', 'top');
|
||||
add_rewrite_rule('^author/([^/]+)/?$', 'index.php?aksrt_author_identifier=$matches[1]', 'top');
|
||||
// Commerce center aliases (work even before WP page is assigned).
|
||||
add_rewrite_rule('^orders/?$', 'index.php?aksrt_orders=1', 'top');
|
||||
add_rewrite_rule('^revenue/?$', 'index.php?aksrt_revenue=1', 'top');
|
||||
});
|
||||
|
||||
// --- 3b. 统一模板拦截器(核心)---
|
||||
|
||||
Reference in new issue
Block a user