Codeigniter ion auth login make multiple user if statement error

429 Views Asked by At

I make more user in System CI, and i try make Auth_controller.php use if statement handle it... when we login using if statement and try to login user 'gudang' its just get $this->load->view('sales/header'); $this->load->view('admin/dashboard'); sales statement, this statement 'gudang' cant load this view

public function index()
{   if (!$this->ion_auth->logged_in()){
        redirect('auth/login', 'refresh');
    }
    elseif ($this->ion_auth->is_admin()){
        //return show_error('You must be an administrator to view this page.');
        // set the flash data error message if there is one
        $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
        $this->data['users'] = $this->ion_auth->users()->result();
        foreach ($this->data['users'] as $k => $user)
        {
    $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
        }
        $this->_render_page('admin/lte/header', $this->data);
        $this->_render_page('admin/dashboard', $this->data);
        // $this->_render_page('admin/lte/footer', $this->data);
    }elseif ($this->ion_auth->get_users_groups($user->id)==='Sales'){
        $this->load->view('sales/header');
        $this->load->view('admin/dashboard');
    }elseif ($this->data['users'] = $this->ion_auth->users('gudang')){
        $this->load->view('gudang/header');
        $this->load->view('admin/dashboard');
    }else{
        redirect('auth/login', 'refresh');
    }
}
0

There are 0 best solutions below