how to query logged in user using ion auth with codeigniter
I asked a similar question a while back but i dont think im doing it
correctly.
im creating a control panel, and the control panel needs to know who's
logged in and if he is an admin, on just about ever page of this project.
right now to get this to work i have this in my header of every page:
$user = $this->ion_auth->user()->row();
$fname = $user->first_name;
$lname = $user->last_name;
$email = $user->email;
$uid = $user->id;
$avatar = $user->avatar;
however, im now thinking i should be able to do this in the model ya?
maybe using a helper or library? if im thinking correctly could someone
give me a rough step by step on how to do that? Ive never created a helper
or library in codeigniter.
No comments:
Post a Comment