How to show users online within past 15 minutes

I’m trying to make a social platform and I need to be able to have the main list of users show only those who are online (defined as having used the app within the past 15 minutes) but i’m completely unable to figure it out. I keep trying to play with the date data types (like online=current date +900 seconds) but it stays red.

Have any of you created an online-status workflow?


On the top of my head, you can do the following. Perform a search where the date is greater than the current date changed to -15 minutes. The search should be on a type where to store the date info, which could be on the User or specialized type. Update the data on a page load or another workflow that is ran when the user is logged in. Ideally, perform this workflow within another workflow that is already occurring so you don’t incur too many workflow runs.


My feeling is that it would make more sense to have this separate from the User’s profile and as a list item in another database.

To do this, I would create a login/logout event and/or a page level event.

  • To flag as active: when the user logs in, add the current user to the List “Active Users.”
  • To flag as inactive: have a time-based page-level workflow (Do every 15 minutes), that removes them from the “Active Users” list
  • To flag as inactive (offline): create a workflow for when the user signs out, it removes them from the list

Upside: you can also let a user set their status as “invisible” or "visible by creating a workflow that removes or adds them from the list.

In that approach, you aren’t doing a database search for users matching the parameter. Rather, you’re displaying a list of users (which you can filter, if needed).


Did you do this? Did it work?

I haven’t. Just a suggested approach. Not quite pertinent to the structure of my app.

In my social app I have a repeating group always showing active users. I do this by having a date field in the Users Thing and a workflow thats runs every 30 secs that sets this field to the current time. My repeating group then searches for Users with this field containing a date not older than 30 secs. The workflow is put in the menu which is a reusable element. This way the action is performed on every page.


Any ideas on how to do it with this new WU system??
I believe making a change every 30 seconds is not good, right?!

1 Like

Maybe use a field on the user of type isOnline? yes/no and use a plugin like this one to change the field value whenever the user goes offline (not necessarily logged out, but away from the session).

One method of doing this would be to have a field on the User called “Last Seen Date”. Everytime a new page is loaded (or if you have a single page app maybe when a new page is shown) this field updates with the current date/time for the user.

I would set this up as a custom event, and then just have a trigger on each page load. That way you can filter an user with “Last Seen” in the past 15 minutes can be displayed with an “online” status

Connect with me:

You can optimize this most by having one page is loaded workflow and running it only when Current User’s lastSeen < Current date/time +minutes -1.

This condition should, in theory, require zero WU to check, and it will mean that it will at most happen once per minute. If you want to use less WU, just increase the number of minutes. I normally do it if the lastSeen date/time is more than 10 minutes ago.

1 Like