Welcome Guest, Not a member yet? Register   Sign In
Community Auth and navigation
#1

I'm trying to use Community Auth on a new project - which is, I have to say, my first proper CodeIgneter project -  and I've got as far as being able to log in and log out which is great.

I've created a couple of views for various pages and I've split out my main navigation into separate views, also.

My problem now is that I want to have items on the navigation that visible dependant on the user level or role of the logged in user.  If I wrap a menu section in 

Code:
if( $this->require_group('group_name') ) {
// menu items here
}

the application errors with  

Code:
Call to undefined method CI_Loader::require_group()

How can I, therefore, restrict sections of my application and not have errors?  Do I need to create my navigation in a controller rather than a view?
Reply
#2

Same problem http://forum.codeigniter.com/thread-6480...#pid330663
Keep calm.
Reply
#3

(03-30-2016, 03:14 AM)AndrewDFrazier Wrote: I'm trying to use Community Auth on a new project - which is, I have to say, my first proper CodeIgneter project -  and I've got as far as being able to log in and log out which is great.

I've created a couple of views for various pages and I've split out my main navigation into separate views, also.

My problem now is that I want to have items on the navigation that visible dependant on the user level or role of the logged in user.  If I wrap a menu section in 

Code:
if( $this->require_group('group_name') ) {
// menu items here
}

the application errors with  

Code:
Call to undefined method CI_Loader::require_group()

How can I, therefore, restrict sections of my application and not have errors?  Do I need to create my navigation in a controller rather than a view?


Normally in views you are going to use the available authentication variables.

See: http://community-auth.com/documentation/...-variables

Like this:


PHP Code:
<?php
if( in_array$auth_role, array('Admin','Manager','Supervisor') ) )
   // ... show a menu item ... 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB