| | |
| | | $page = $this->getCurrentPageTitle(); |
| | | // Check if page exists in allowed pages |
| | | $allowedPages = $this->getUserAllowedPages(); |
| | | |
| | | error_log('Allowed pages: '.print_r($allowedPages, true)); |
| | | if (!in_array($page, $allowedPages)) { |
| | | error_log("User not allowed to access page: {$page}"); |
| | | $this->redirectToDashboard(); |
| | |
| | | |
| | | public function renderIndex(string $content, string $page):string |
| | | { |
| | | jvbDump($page); |
| | | if ($page !== '' && $page !== 'dash') { |
| | | return $content; |
| | | } |
| | |
| | | |
| | | echo jvbNewModal( |
| | | 'edit-modal '.$type, |
| | | 'edit-modal', |
| | | 'Edit '.ucfirst($type), |
| | | jvbRenderForm('admin', $fields) |
| | | ); |
| | |
| | | } |
| | | |
| | | if (!$user || !$this->userHasDashboardAccess($user)) { |
| | | error_log('No Dashboard Access'); |
| | | return []; |
| | | } |
| | | |
| | | |
| | | $pages = $this->cache->get($userID); |
| | | |
| | | $pages = false; |
| | | if ($pages === false || JVB_TESTING) { |
| | | if (user_can($userID, 'manage_options')) { |
| | | // Admin gets all pages as flat array |
| | |
| | | $pages = $this->getAllDashboardPages(); |
| | | |
| | | $canSkip = user_can($userID, 'skip_moderation'); |
| | | jvbDump($pages, 'All Pages'); |
| | | foreach($pages as $key => $slug) { |
| | | //Default to Remove pages |
| | | $remove = true; |
| | |
| | | } |
| | | } |
| | | break; |
| | | case 'Account': |
| | | case 'dash': |
| | | case 'Referrals': |
| | | case 'favourites': |