Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
ton dev
how to detect if user is logged in to site from another browser?
October 14, 2012 8:14 PM
Answer

ton dev

Rank: New Member

Posts: 18

Join Date: February 8, 2012

Recent Posts

how to detect if user is logged in to site from another browser?
Hitoshi Ozawa
RE: how to detect if user is logged in to site from another browser?
October 14, 2012 9:19 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Check if the user is already logged in and then check the session id?
ton dev
RE: how to detect if user is logged in to site from another browser?
October 16, 2012 9:04 AM
Answer

ton dev

Rank: New Member

Posts: 18

Join Date: February 8, 2012

Recent Posts

sorry for the dumb question.. i think checking the user details in UserTrackerLocalServiceUtil will help me...
Vitaliy Koshelenko
RE: how to detect if user is logged in to site from another browser?
October 16, 2012 9:08 AM
Answer

Vitaliy Koshelenko

Rank: Expert

Posts: 286

Join Date: March 25, 2011

Recent Posts

Hi!

You can use com.liferay.portal.liveusers.LiveUsers#_getLiveUsers to check which users are currently online.

Vitaliy
ton dev
RE: how to detect if user is logged in to site from another browser?
October 16, 2012 5:44 PM
Answer

ton dev

Rank: New Member

Posts: 18

Join Date: February 8, 2012

Recent Posts

@Vitaliy Koshelenko
Thanks for the suggestion, I'll look in to that
Bart Simpson
RE: how to detect if user is logged in to site from another browser?
October 16, 2012 9:15 PM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

Vitaliy,
You can use com.liferay.portal.liveusers.LiveUsers#_getLiveUsers to check which users are currently online

Small question in this regard, will it not require the live user tracking to be enabled?
ton dev
RE: how to detect if user is logged in to site from another browser?
October 23, 2012 7:13 PM
Answer

ton dev

Rank: New Member

Posts: 18

Join Date: February 8, 2012

Recent Posts

can i get the list of LiveUsers in a portlet... I was able to set the live.users.enabled=true in portal-ext-properties and was able to see the list of live users in the Control Panel->Monitoring but when tried

1       Iterator<UserTracker> loggedInUsers1 = LiveUsers.getSessionUsers(1).values().iterator();
2          while (loggedInUsers1.hasNext()) {
3               UserTracker userTracker = loggedInUsers1.next();
4              System.out.println(userTracker.getFullName());
5            }


nothings happening.. even an exception wont log

im developing in LP6.0.5

any suggestions??
parikshit sharma
RE: how to detect if user is logged in to site from another browser?
October 23, 2012 11:29 PM
Answer

parikshit sharma

Rank: Junior Member

Posts: 50

Join Date: October 18, 2012

Recent Posts

ton dev:
can i get the list of LiveUsers in a portlet... I was able to set the live.users.enabled=true in portal-ext-properties and was able to see the list of live users in the Control Panel->Monitoring but when tried

1       Iterator<UserTracker> loggedInUsers1 = LiveUsers.getSessionUsers(1).values().iterator();
2          while (loggedInUsers1.hasNext()) {
3               UserTracker userTracker = loggedInUsers1.next();
4              System.out.println(userTracker.getFullName());
5            }


nothings happening.. even an exception wont log

im developing in LP6.0.5

any suggestions??


Probably Live Users class won't be available in custom portlet or out of box portlet,so you can't use above code in your portlet( custom portlet).
Jitendra Rajput
RE: how to detect if user is logged in to site from another browser?
October 25, 2012 1:49 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 858

Join Date: January 7, 2011

Recent Posts

com.liferay.portal.liveusers.LiveUsers this class is part of portal-imp you can not use it in your custom portlet.
Check below thread for similar kind of issue

http://www.liferay.com/community/forums/-/message_boards/message/14281515