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).