Developer forum

Forum » CMS - Standard features » Checking current login user

Checking current login user

Dynamicweb Employee
Thet Nong Phu
Reply

Dear Sir,

Is any way to check the list of current login user in the front end?

Thanks

Phu


Replies

 
Nicolai Pedersen
Reply

When people are logged in or not is not easy to say as session can expire etc.

But you can query users that have logged in recently which would give you a very good idea - these are the users that have logged in in the past 20 minutes whos sessions might be active:

SELECT TOP (100) [AccessUserID]

      ,[AccessUserUserName]

      ,[AccessUserName]

      ,[AccessUserEmail]

   ,[AccessUserLastLoginOn]

  FROM [dw9].[dbo].[AccessUser]

  where [AccessUserLastLoginOn] > DATEADD(MINUTE, -20, GETDATE())

    order by [AccessUserLastLoginOn] desc
 
You can also do the same looking at Statv2Session table - there will be userid in one of the columns and you can see when users last made a pageview.
 
BR Nicolai
 
Nicolai Pedersen
Reply
This post has been marked as an answer

Statv2session example:

select top 100 * from Statv2Session where Statv2SessionExtranetUserID > 0 and Statv2SessionTimestamp > DATEADD(MINUTE, -20, GETDATE()) order by Statv2SessionTimestampEnd desc
Votes for this answer: 1
 
Dynamicweb Employee
Thet Nong Phu
Reply

Dear Nicolai,

Thanks for your quick response and solution.

Thanks

Phu

 

You must be logged in to post in the forum