Check User Online Or Not. Big Thanks!

Hi everyone,

Is there a way I can determine a user is online or not ? I don’t have a table for sessions now.

(Like show a little green light after the username is the user is online…)

btw, I’m using yii-user.

Best,

You can save on a table the time of the last request by the user and consider him as "online" if the request fits a threshold (say 5 minutes).

Is there a way I can add in the main controller so I don’t have to do this in every action?

A CWebApplication event would be the perfect fit for you.