Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Juhi Kumari
Always getting the same userId in template
February 5, 2013 10:44 PM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
I want the loged-in user id in my web content template. For this in template I use
1#set($userId = $getterUtil.getLong($request.get("theme-display").get("user-id")))
2or
3#set ($uId = $getterUtil.getLong($request.remote-user))

But it always return user id of Test Test only . Don't know where I am missing??
If any idea please share!!!!

Regards
Juhi
Jitendra Rajput
RE: Always getting the same userId in template
February 5, 2013 10:51 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 875

Join Date: January 7, 2011

Recent Posts

I guess UserId is default variable it should be directly available . No need to get it from request .
try to print $user_id
Juhi Kumari
RE: Always getting the same userId in template
February 5, 2013 11:12 PM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi Jitendra,

Thanks for your reply. But Its not working..emoticon

Regards
Juhi
Jitendra Rajput
RE: Always getting the same userId in template
February 5, 2013 11:18 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 875

Join Date: January 7, 2011

Recent Posts

Did you tried by setting below property in portal-ext ?

journal.template.velocity.restricted.variables=
Juhi Kumari
RE: Always getting the same userId in template
February 5, 2013 11:20 PM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
Already I did that one, then only I am getting same userId always.

Regards
Juhi
James Falkner
RE: Always getting the same userId in template
February 5, 2013 11:37 PM
Answer

James Falkner

Community Moderator

Rank: Liferay Legend

Posts: 1406

Join Date: September 17, 2010

Recent Posts

Juhi Kumari:
Hi,
Already I did that one, then only I am getting same userId always.

Regards
Juhi


You need to uncheck the "Cacheable" option when editing the template.
Juhi Kumari
RE: Always getting the same userId in template
February 6, 2013 1:09 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi James,

Thanks for your reply. Now its working fine.

Regards
Juhi

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!