Guest User

login

a guest
Feb 22nd, 2016
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. // redirect if needed, otherwise display the user list
  2.     function index()
  3.     {
  4.  
  5.         if (!$this->ion_auth->logged_in())
  6.         {
  7.             // redirect them to the login page
  8.             redirect('auth/login', 'refresh');
  9.         }
  10.  
  11.         $group = 'members';
  12.         if (!$this->ion_auth->in_group($group))
  13.         {
  14.             echo "here is member bodat";
  15.         }  
  16.         elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
  17.         {
  18.             // redirect them to the home page because they must be an administrator to view this
  19.             return show_error('You must be an administrator to view this page.');
  20.         }
  21.         else
  22.         {
  23.             // set the flash data error message if there is one
  24.             $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
  25.  
  26.             //list the users
  27.             $this->data['users'] = $this->ion_auth->users()->result();
  28.             foreach ($this->data['users'] as $k => $user)
  29.             {
  30.                 $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
  31.             }
  32.  
  33.             $this->_render_page('auth/index', $this->data);
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment