Jake Vanderwerf
2026-01-22 58e8ae0759ccfa97c478ccae4e0778bdce70966f
inc/managers/DashboardManager.php
@@ -67,18 +67,21 @@
        $singular = 'Dashboard';
        register_post_type(BASE.'dash', array(
            'labels'                => [
                'name' => $plural,
                'singular_name' => $singular,
                'menu_name' => $plural,
                'add_new' => "Add New {$singular}",
                'add_new_item' => "Add New {$singular}",
                'edit_item' => "Edit {$singular}",
                'new_item' => "New {$singular}",
                'view_item' => "View {$singular}",
                'search_items' => "Search {$plural}",
                'not_found' => "No {$plural} found",
                'not_found_in_trash' => "No {$plural} found in Trash"
            ],
            'name'               => $plural,
            'singular_name'      => $singular,
            'menu_name'          => $plural,
            'name_admin_bar'     => $singular,
            'add_new'            => "Add New",
            'add_new_item'       => "Add New {$singular}",
            'new_item'           => "New {$singular}",
            'edit_item'          => "Edit {$singular}",
            'view_item'          => "View {$singular}",
            'all_items'          => "All {$plural}",
            'search_items'       => "Search {$plural}",
            'parent_item_colon'  => "Parent {$plural}:",
            'not_found'          => "No {$plural} found.",
            'not_found_in_trash' => "No {$plural} found in Trash.",
         ],
            'menu_icon'             => jvbCSSIcon('gauge'),
            'public'                => true,
            'publicly_queryable'    => true,
@@ -100,12 +103,24 @@
     */
    public function redirectFromAdmin()
    {
      // Skip if already processing a redirect
      if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
      }
      // Ensure user is fully loaded
      if (!did_action('wp_loaded')) {
         return;
      }
        // Allow admins to access wp-admin if needed
        if (current_user_can('manage_options')) {
            return;
        }
        // Redirect to custom dashboard
         $this->redirectToDashboard();
         if (is_user_logged_in() && isOurPeople()) {
         $this->redirectToDashboard();
      }
    }
   protected function redirectToLogin():void
@@ -198,7 +213,6 @@
         if (!in_array($page, $allowedPages)) {
            error_log("User not allowed to access page: {$page}");
            $this->redirectToDashboard();
            return;
         }
      }
   }
@@ -680,6 +694,7 @@
                <ul>
                    <?= jvbNotificationMenu() ?>
                    <?= jvbHelpMenu() ?>
                    <li><a href="<?=wp_logout_url(get_home_url())?>" title="Logout"><?=jvbIcon('sign-out')?></a></li>
                </ul>
            </nav>
        </header>