Check if user has access to a specific page.

Feed 2 posts, 3 voices

Avatar
31 posts

How do I check if the user has access to a specific page?

What I want to do is show/hide menus if the user is/isn’t logged in.

This is my ‘sub menus’ snippet:

<?php
   if (count($this->children()) > 0) {
     foreach($this->children() as $menu):
       echo '<li>'.$menu->link($menu->title, (in_array($menu->slug, explode('/', $this->url)) ? ' class="current"': null)).'</li>';
     endforeach;
   }
?>

I would also like to do this with the Main Menu

 
Avatar
10 posts

OFFTOPIC:
dont know, please someone modify the DOCUMENTATION !
-> its taking too long to help the community without proper documentation.

 
Avatar
26 posts

Try something like this:

<?php
    AuthUser::load();
    if (AuthUser::isLoggedIn() && AuthUser::hasPermission('administrator')) {
        echo 'Hi! You're an administrator!';
    }
?>