Listing Logged In Users (like the admin 'all user slots used' screen)
I've noticed that admin users can see all the users logged in, and give the admin ability to kick off users. But main issue is if you are not admin, you don't see any list of users.
What i want to do is display the users to a regular user whom are logged in. This is to create a process where we're running out of slots and some users don't log out.
I would rather upgrade my user slot count at a premium price but I suppose there is no option for that, but rather to spend a significant amount more to upgrade the the next package. We'd rather pay for more slots vs an entire feature set we likely won't use (yet).
Where in Sitefinity does it display the logged in users? I've wanted this feature for sometime but can not find it.
I found it, it's on the main user page in the back end under status.
So I'm trying to recreate this feature.
var userManager = UserManager.GetManager();
var users = userManager.GetUsers().OrderBy(user => user.UserName).ToList();
var usersLoggedIn = users.Where(user => user.IsLoggedIn).ToList();
But I seem to get almost 38 users. Now, I looked at the database, and did a select by
SELECT * FROM [sf635000_intranet].[dbo].[sf_users]
WHERE is_logged_in = 1 ORDER BY last_login_date DESC
But there I know some users logged out, which would explain why this select statement fails. I could have someone who's listed as the 8th row, but they still show as logged in on the CMS. Isn't there a 'last_logged_out' column I could use?
What would the proper API method be to get 'the currently logged in users'??
This is a known issue in Sitefinity and we have logged a bug related to it in our feedback portal:
User.IsLoggedIn does not display the correct status
The issue is fixed in internal build 8.0.5719.0 and what I can suggest is to upgrade your Sitefinity project to the latest internal build of Sitefinity 8.0 or directly to Sitefinity 8.1 where the fix is also included. Please refer to the following documentation article for more details about the supported upgrade procedure.
If you decide to upgrade to the internal build, please note that you can download the latest internal build for each Sitefinity version from your Sitefinity.com account in section Products & Subscriptions -> Latest Internal Builds.