pwfans Posted July 13, 2018 Share Posted July 13, 2018 Is there any builtin session created automatically when admin logged in ? Currently i do this way to detect admin login or not; - Install core module Session Handler Database, i can see in database when admin login/logout - Because i don't know whats API to use to to fetch above data, i'm using $db->query("select .. from .. where") - From query result above i can make if statement admin logged do this, else do that for any page, eg: prevent opening certain page if admin not login. Anyone knows what API to use to handle that process ? thank you Link to comment Share on other sites More sharing options...
Robin S Posted July 13, 2018 Share Posted July 13, 2018 These two spring to mind: $user->isLoggedin() $user->isSuperuser() 1 Link to comment Share on other sites More sharing options...
pwfans Posted July 13, 2018 Author Share Posted July 13, 2018 Thank you, what stupid i am ! ? $user->isSuperuser() Yes, this one work ! thank you. if ($user->isSuperuser()) { echo "do this"; } else { echo "do that"; } Mean: if current user login has superuser role, do this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now