this is the function I have, in my login controller, which stores data into an array and then set the userdata
function validate_credentials()
{
$this->load->model('membership_model');
$query = $this->membership_model->validate();
if($query):
$data = array(
'username' => $this->input->post('username'),
//add usertype
//add email
//add deposit money
'is_logged_in' => true
);
$this->session->set_userdata($data);
//should redirect to last view
redirect('home/index');
else:
$this->index();
endif;
}// end of validate_credentials()
I would like to store more information like the usertype, email, depost,etc... the data is stored into the database. How do I get the data from the model to controller? or is this not recommended?
for example with the usertype I want to check in the views if the user is an admin and display certain options for admins only.