[eluser]toymachiner62[/eluser]
I have an admin area and I want to have certain links visible depending on the user's access. What is the best way to do this?
Right now all I have is this code for the nav links
Code:
<nav>
<ol>
<li><?php echo anchor('member/publicNews', 'Public News'); ?></li>
<li><?php echo anchor('member/memberNews', 'Member News'); ?></li>
<li><?php echo anchor('member/publicCalendar', 'Public Calendar'); ?></li>
<li><?php echo anchor('member/memberCalendar', 'Member Calendar'); ?></li>
<li><?php echo anchor('member/photoAlbums', 'Photos'); ?></li>
<li><?php echo anchor('member/files', 'Files'); ?></li>
</ol>
</nav>
Let's say I only want the "Files" link to be visible to people with super user access. I was thinking of when a user logs in, set an access level in a session parameter and then do something like this.
Code:
<ol>
<li><?php echo anchor('member/publicNews', 'Public News'); ?></li>
<li><?php echo anchor('member/memberNews', 'Member News'); ?></li>
<li><?php echo anchor('member/publicCalendar', 'Public Calendar'); ?></li>
<li><?php echo anchor('member/memberCalendar', 'Member Calendar'); ?></li>
<li><?php echo anchor('member/photoAlbums', 'Photos'); ?></li>
<li><?php if($this->session->userdata('accessLevel') == 1) {echo anchor('member/files', 'Files'); }?></li>
</ol>
Is that the best way to do that or is there a better way?