ion_auth - Is there a way to detected logged in users |
[eluser]nnolting[/eluser]
Can anyone tell me if there is a way to detect users that are logged in with ion_auth? I can detect if I am logged in with the Code: $this->ion_auth->logged_in()
[eluser]nnolting[/eluser]
[quote author="cideveloper" date="1337186428"]Query the auth database.[/quote] The only column that I can see useful in that table (users) is 'last_login' but that does not necessary tell anything about who is logged in at a particular moment.
[eluser]jkevinburton[/eluser]
I would change my sessions to database and then query that sessions table for last activity within a 5-15 minute span depending on your personal threshold. I know this could be tricky. I would modify the session library to add a second field 'is_logged_in' - and since the ion_auth library uses sessions, take advantage of this. May not be the best solution, but i just took it off the top of my head.
[eluser]cideveloper[/eluser]
Are you using DB sessions. If yes, when the user logs in, add some Custom Session Data that matches the session with the users table. I usually add the id, username, and email. Your login code could be something like this Code: $username = $this->input->post('username'); Then if you, the admin wants to see who is logged in you can query the ci_session table and get the info from the user_data field.
[eluser]nnolting[/eluser]
I'll give that a try, I've read about the session storage stuff, but never tried it out, this might be the time. |
Welcome Guest, Not a member yet? Register Sign In |