| | |
| | | <?php |
| | | namespace JVBase\managers; |
| | | |
| | | use JVBase\forms\TaxonomySelector; |
| | | use JetBrains\PhpStorm\NoReturn;use JVBase\forms\TaxonomySelector; |
| | | use JVBase\base\Site; |
| | | use JVBase\meta\Form; |
| | | use JVBase\registrar\Registrar; |
| | |
| | | /** |
| | | * Redirect all non-admin users from wp-admin to custom dashboard |
| | | */ |
| | | public function redirectFromAdmin() |
| | | public function redirectFromAdmin():void |
| | | { |
| | | // Skip if already processing a redirect |
| | | if (defined('DOING_AJAX') && DOING_AJAX) { |
| | |
| | | } |
| | | } |
| | | |
| | | protected function redirectToLogin():void |
| | | #[NoReturn]protected function redirectToLogin():void |
| | | { |
| | | wp_redirect(wp_login_url(get_home_url(null, '/dash'))); |
| | | exit; |
| | | } |
| | | |
| | | protected function redirectToDashboard():void |
| | | #[NoReturn]protected function redirectToDashboard():void |
| | | { |
| | | wp_redirect(get_home_url(null, '/dash')); |
| | | exit; |
| | |
| | | if (!is_404() && !is_user_logged_in()) { |
| | | error_log('Redirecting to login - user not logged in'); |
| | | $this->redirectToLogin(); |
| | | return; |
| | | } |
| | | |
| | | // If logged in but doesn't have dashboard access, redirect to home |
| | |
| | | if (is_404() && (str_starts_with($wp->request, 'dash/') || $wp->request === 'dash')) { |
| | | error_log('404 on dashboard URL, redirecting to dashboard home'); |
| | | $this->redirectToDashboard(); |
| | | return; |
| | | } |
| | | |
| | | // For valid dashboard pages, check access permissions |
| | |
| | | $this->renderHeader(); |
| | | // Pass to page handler |
| | | $constantSlug = $this->getConstantSlug($page); |
| | | |
| | | echo apply_filters( |
| | | 'jvbDashboardPage', |
| | | $this->renderPage($page), |