Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
ramveer singh narwariya
i want to display the No. of user currently login on website ?
November 2, 2012 12:24 AM
Answer

ramveer singh narwariya

Rank: Junior Member

Posts: 64

Join Date: April 13, 2012

Recent Posts

i want to display the No. of user currently login on website and also display the user activity on website. can any one tell me how to do that ?
when i am using inbuild social activity portlet it does not display the user activity .
Harish Kumar
RE: i want to display the No. of user currently login on website ?
November 2, 2012 12:29 AM
Answer

Harish Kumar

Rank: Expert

Posts: 397

Join Date: July 31, 2010

Recent Posts

Look at the following properties in portal.properties file

 1
 2  #
 3    # Set this to true to track user clicks in memory for the duration of a
 4    # user's session. Setting this to true allows you to view all live sessions
 5    # in the Admin portlet.
 6    #
 7    session.tracker.memory.enabled=true
 8
 9    #
10    # Set this to true to track user clicks in the database after a user's
11    # session is invalidated. Setting this to true allows you to generate usage
12    # reports from the database. Use this cautiously because this will store a
13    # lot of usage data.
14    #
15    session.tracker.persistence.enabled=false
16
17    #
18    # Set this to true to convert the tracked paths to friendly URLs.
19    #
20    session.tracker.friendly.paths.enabled=false


Also USERTRACKER and USERTRACKERPATH tables are there in DB where data is persisted.

HTH
ramveer singh narwariya
RE: i want to display the No. of user currently login on website ?
November 2, 2012 1:55 AM
Answer

ramveer singh narwariya

Rank: Junior Member

Posts: 64

Join Date: April 13, 2012

Recent Posts

thank for reply.
can you post related code.
Harish Kumar
RE: i want to display the No. of user currently login on website ?
November 2, 2012 2:15 AM
Answer

Harish Kumar

Rank: Expert

Posts: 397

Join Date: July 31, 2010

Recent Posts

I haven't used this functionality before so don't have any code to share.
Siby Mathew
RE: i want to display the No. of user currently login on website ?
November 2, 2012 3:35 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

You can also have a look in :
1com.liferay.portal.liveusers.LiveUsers

inside portal-impl.jar

Thanks,
Siby
Tejas Kanani
RE: i want to display the No. of user currently login on website ?
November 2, 2012 5:57 AM
Answer

Tejas Kanani

Rank: Liferay Master

Posts: 653

Join Date: January 6, 2009

Recent Posts

Check below code. It might help. Which will give you current sessionUsers.

1Map<String, UserTracker> sessionUsers = LiveUsers.getSessionUsers(company.getCompanyId());
2List<UserTracker> userTrackers = new ArrayList<UserTracker>(sessionUsers.values());
3userTrackers = ListUtil.sort(userTrackers, new UserTrackerModifiedDateComparator());


Thanks,
Tejas
ramveer singh narwariya
RE: i want to display the No. of user currently login on website ?
November 5, 2012 1:02 AM
Answer

ramveer singh narwariya

Rank: Junior Member

Posts: 64

Join Date: April 13, 2012

Recent Posts

Tejas Kanani:
Check below code. It might help. Which will give you current sessionUsers.

1Map<String, UserTracker> sessionUsers = LiveUsers.getSessionUsers(company.getCompanyId());
2List<UserTracker> userTrackers = new ArrayList<UserTracker>(sessionUsers.values());
3userTrackers = ListUtil.sort(userTrackers, new UserTrackerModifiedDateComparator());


Thanks,
Tejas

Hi Tejas,
your code is not working in my system. it give error at Liveusers. can you tell me what is LIveUsers or how to define LiveUsers.
Jitendra Rajput
RE: i want to display the No. of user currently login on website ?
November 5, 2012 1:10 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 858

Join Date: January 7, 2011

Recent Posts

ramveer singh narwariya:

your code is not working in my system. it give error at Liveusers. can you tell me what is LIveUsers or how to define LiveUsers.


LiveUsers this is part of portal-imp you can not directly access inside your plugins. As suggested by Harish try to explore UserTrackerLocalServiceUtil and UserTrackerPathLocalServiceUtil
parikshit sharma
RE: i want to display the No. of user currently login on website ?
November 5, 2012 3:36 AM
Answer

parikshit sharma

Rank: Junior Member

Posts: 47

Join Date: October 18, 2012

Recent Posts

Ramveer,
have you checked this post ,please have a look
http://www.liferay.com/community/forums/-/message_boards/message/17203320
ramveer singh narwariya
RE: i want to display the No. of user currently login on website ?
November 6, 2012 3:18 AM
Answer

ramveer singh narwariya

Rank: Junior Member

Posts: 64

Join Date: April 13, 2012

Recent Posts

when i add porttal iml.jar file , then tomcat give the error. but if i not add this jar file then LIVEUSERs give error .
can you give tell me some other solution for it
ramveer singh narwariya
RE: i want to display the No. of user currently login on website ?
November 6, 2012 3:19 AM
Answer

ramveer singh narwariya

Rank: Junior Member

Posts: 64

Join Date: April 13, 2012

Recent Posts

thanks for reply
but i am still not get solution.
Siby Mathew
RE: i want to display the No. of user currently login on website ?
November 6, 2012 5:57 AM
Answer

Siby Mathew

Rank: Expert

Posts: 261

Join Date: March 4, 2011

Recent Posts

Hi Ramveer,
You should not add portal-impl.jar to your portlet. That is wrong.
As suggested by Harish, please see UserTrackerLocalServiceUtil and UserTrackerPathLocalServiceUtil. These are available in portal-service.jar which is available to you.

Thanks,
Siby