How to find if a specific user is logged in?

There are any way to check if a user is logged in?

For example some forums have a list of logged in users, of in many cases you can see close to username a green flag if the users is online or a red one if the users is not logged in.

In my website I use yii2-user from dektrium, but I’m not finding any way to check if a users is logged in or not


As far was I know there is no "easy" pre-build solution for this.

Look at this thread:

I think you may store the sessions in a db and check for the active ones