Check if user is online right now sitewide?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 1 año
my site uses nC 4.50.2
i would like to display text "user is online" when user is online on site
i would like to display this text in:
/views/customer/info.cshtml

how can i check it for example by user id?
example:
user id 145214
if user online, then display text "user is online"
Hace 1 año
What do you mean by online ?
If you mean they are logged in then you should not be able to get to the view
/views/customer/info.cshtml unless they are logged in
So just display a message - no need to check anything ?

Or is Sitewide some extra requirement ?
Hace 1 año
Please check the "LastActivityDateUtc" property of this customer
Hace 1 año
Yidna wrote:
What do you mean by online ?
If you mean they are logged in then you should not be able to get to the view
/views/customer/info.cshtml unless they are logged in
So just display a message - no need to check anything ?

Or is Sitewide some extra requirement ?


i mean i want to track if user is online right now on the site and show this info near his login for all other users
Hace 1 año
Yidna wrote:
What do you mean by online ?
If you mean they are logged in then you should not be able to get to the view
/views/customer/info.cshtml unless they are logged in
So just display a message - no need to check anything ?

Or is Sitewide some extra requirement ?


for example on page mysite.com/profile/14524
if user is on the site right now, then show this on the profile page that use is online right now
how do to it?
Hace 1 año
you can check the implementation of  Online customers

Alternatively, you can display the online status of the user if they are logged in by using the following code:
if(currentCustomer.IsLoggedIn)
{
    DisplayOnlineStatus()
}
Hace 1 año
"proper" customization requires modifications to MVC (Model/View/Controller) and \Factories\ProfileModelFactory.cs

"quick" customization is to just modify View
(Probably \Views\Profile\Components\ProfileInfo\Default.cshtml )
And use "Resolve" to get the customer, and then as per above, calculate based on "Please check the "LastActivityDateUtc" property of this customer".

( Note, that there's no guarantee that the user is still online.   The admin "Online customers" list uses some # of minutes since LastActivityDateUtc.)
Hace 1 año
New York wrote:
"proper" customization requires modifications to MVC (Model/View/Controller) and \Factories\ProfileModelFactory.cs

"quick" customization is to just modify View
(Probably \Views\Profile\Components\ProfileInfo\Default.cshtml )
And use "Resolve" to get the customer, and then as per above, calculate based on "Please check the "LastActivityDateUtc" property of this customer".

( Note, that there's no guarantee that the user is still online.   The admin "Online customers" list uses some # of minutes since LastActivityDateUtc.)


thanks for reply.
could you please give me some code example for showing this?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.