The following sample code shows how you can check if a user specified by their ID is on-line on a given site; the IsUserOnline(...) method returns a boolean value:
[C#]
using CMS.CMSHelper; using CMS.SiteProvider;
...
string siteName = "CorporateSite"; int userID = 10; bool includeHidden = true;
// Get user and site objects UserInfo ui = UserInfoProvider.GetUserInfo(userID); SiteInfo si = SiteInfoProvider.GetSiteInfo(siteName);
// If both exist if ((ui != null) && (si != null)) { // Check if user is online SessionManager.IsUserOnline(siteName, userID, includeHidden); } |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_checking_if_a_user_is_on_line.htm