Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Is there an easy way to count users currently online

+1 vote
asked Mar 12, 2012 in Q2A Core by Merkus
I haven't looked through the code for this yet, but from looking at the db it looks like there might be something in one of the tables that could be counted.
Q2A version: 1.5

2 Answers

0 votes
answered Mar 13, 2012 by NoahY
selected Mar 14, 2012 by Merkus
Best answer

just record the output of qa_get_logged_in_userid() to the database, along with time(), and then run a database query to get all userids where the time recorded is say within one or two minutes of the current time.  Ajax refresh would also be possible.  Note, if you have the badges plugin installed, this info is already stored in the ^achievements table, so you can just get it from there.

commented Mar 14, 2012 by Merkus
Thanks. This is probably what I will end up doing in a new table. I am not using badges yet - maybe later.
+1 vote
answered Mar 13, 2012 by q2apro
It would also be a nice feature to have a "who is online" list of all users :) ... plugin?

One way to get each user online is explained here by gidgreen: http://www.question2answer.org/qa/6792/how-to-check-whether-the-given-user-is-online

btw, similar question: http://www.question2answer.org/qa/8229/is-there-any-widget-to-show-users-offline-online