Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Juhi Kumari
Always getting the same userId in template
5. Februar 2013 22:44
Antwort

Juhi Kumari

Rang: Expert

Nachrichten: 347

Eintrittsdatum: 12. Dezember 2011

Neue Beiträge

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
5. Februar 2013 22:51
Antwort

Jitendra Rajput

Rang: Liferay Master

Nachrichten: 875

Eintrittsdatum: 7. Januar 2011

Neue Beiträge

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
5. Februar 2013 23:12
Antwort

Juhi Kumari

Rang: Expert

Nachrichten: 347

Eintrittsdatum: 12. Dezember 2011

Neue Beiträge

Hi Jitendra,

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

Regards
Juhi
Jitendra Rajput
RE: Always getting the same userId in template
5. Februar 2013 23:18
Antwort

Jitendra Rajput

Rang: Liferay Master

Nachrichten: 875

Eintrittsdatum: 7. Januar 2011

Neue Beiträge

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
5. Februar 2013 23:20
Antwort

Juhi Kumari

Rang: Expert

Nachrichten: 347

Eintrittsdatum: 12. Dezember 2011

Neue Beiträge

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
5. Februar 2013 23:37
Antwort

James Falkner

Community Moderator

Rang: Liferay Legend

Nachrichten: 1406

Eintrittsdatum: 17. September 2010

Neue Beiträge

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
6. Februar 2013 01:09
Antwort

Juhi Kumari

Rang: Expert

Nachrichten: 347

Eintrittsdatum: 12. Dezember 2011

Neue Beiträge

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!