check what users are currently online

Permalink 1 user found helpful
Is it possible to check what users are logged on currently?
I thought
$ui->isActive()

would work but after trying it i realized it just returns if the user is authorized.

Is there some sort of method for getting currently online users?

mikeyt55
 
mikeyt55 replied on at Permalink Reply
mikeyt55
well I have tried:
foreach($users as $vall) {
               $id_tmp = $vall->getUserID();
               $ui_tmp = UserInfo::getByID($id_tmp);
               $u_tmp = $ui_tmp->getUserObject();
                  if($u_tmp->isLoggedIn()) {
                     echo $vall->getUserName();
                  }
            }

and
foreach($users as $vall) {
               $id_tmp = $vall->getUserID();
               $ui_tmp = UserInfo::getByID($id_tmp);
               $u_tmp = $ui_tmp->getUserObject();
                  if($u_tmp->checkLogin()) {
                     echo $vall->getUserName();
                  }
            }
[code]

but both return true for all users
mnakalay replied on at Permalink Reply
mnakalay
Hi,
There's a free add-on that does just that:
http://www.concrete5.org/marketplace/addons/whos-online/...
JohntheFish replied on at Permalink Reply
JohntheFish
User logins last for 2 weeks, hence the skew in data.

As @manakaly notes, there are addons that track user activity and who is logged in.

Alternatively, look at the last XX mins of page statistics and note who the users are. That will give you a list of all users who have viewed any page in the last XX mins.

Or you can do it with Magic Data
"last hour" LIST_ACTIVE_USERS 100
mikeyt55 replied on at Permalink Reply
mikeyt55
unfortunately who's online only shows me the amount of users on the site, not the users that are logged in.

Was wanting something a bit more percise than checking when they were last online but looks like that's the way I will go