Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Juhi Kumari
Always getting the same userId in template
5 de Fevereiro de 2013 22:44
Resposta

Juhi Kumari

Ranking: Expert

Mensagens: 347

Data de entrada: 12 de Dezembro de 2011

Mensagens recentes

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 de Fevereiro de 2013 22:51
Resposta

Jitendra Rajput

Ranking: Liferay Master

Mensagens: 875

Data de entrada: 7 de Janeiro de 2011

Mensagens recentes

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 de Fevereiro de 2013 23:12
Resposta

Juhi Kumari

Ranking: Expert

Mensagens: 347

Data de entrada: 12 de Dezembro de 2011

Mensagens recentes

Hi Jitendra,

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

Regards
Juhi
Jitendra Rajput
RE: Always getting the same userId in template
5 de Fevereiro de 2013 23:18
Resposta

Jitendra Rajput

Ranking: Liferay Master

Mensagens: 875

Data de entrada: 7 de Janeiro de 2011

Mensagens recentes

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 de Fevereiro de 2013 23:20
Resposta

Juhi Kumari

Ranking: Expert

Mensagens: 347

Data de entrada: 12 de Dezembro de 2011

Mensagens recentes

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 de Fevereiro de 2013 23:37
Resposta

James Falkner

Community Moderator

Ranking: Liferay Legend

Mensagens: 1406

Data de entrada: 17 de Setembro de 2010

Mensagens recentes

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 de Fevereiro de 2013 01:09
Resposta

Juhi Kumari

Ranking: Expert

Mensagens: 347

Data de entrada: 12 de Dezembro de 2011

Mensagens recentes

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!