Fórumok

Get current group ID

John Bernardini, módosítva 15 év-val korábban

Get current group ID

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2008.06.16. Legújabb bejegyzések
hi,

I'm developing a portlet that shows journal articles. I need to specify the community id to filter content in each community. How can I get community id in my code?
thumbnail
Fuad Efendi, módosítva 15 év-val korábban

Re: [Liferay Forums][3. Development] Get current group ID

Regular Member Bejegyzések: 180 Csatlakozás dátuma: 2007.04.05. Legújabb bejegyzések
Use portletGroupId (predefined variable) in your JSP.


Quoting John Bernardini at Liferay's Community Forums <no-reply@liferay.com>:

> hi,
>
> I'm developing a portlet that shows journal articles. I need to
> specify the community id to filter content in each community. How can
> I get community id in my code?
> --
> Liferay Community Forum
> mb.239390.1065754@events.liferay.com
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1065754
John Bernardini, módosítva 15 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2008.06.16. Legújabb bejegyzések
For the jsp I havan't problem. What class can do it in the source code of the portlet?
thumbnail
Fuad Efendi, módosítva 15 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

Regular Member Bejegyzések: 180 Csatlakozás dátuma: 2007.04.05. Legújabb bejegyzések
You need to pass it to source code as parameter; source code for
portlet have no knowledge on potlet instance of community... "Layout"
belongs to "Community", "Portlet Instance" belongs to "Layout"...

Quoting John Bernardini at Liferay's Community Forums <no-reply@liferay.com>:

> For the jsp I havan't problem. What class can do it in the source
> code of the portlet?
> --
> Liferay Community Forum
> mb.239390.1065815@events.liferay.com
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1065815
John Bernardini, módosítva 15 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

Junior Member Bejegyzések: 30 Csatlakozás dátuma: 2008.06.16. Legújabb bejegyzések
Thanks a lot. Now it run.
alain raybon, módosítva 15 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

New Member Bejegyzések: 9 Csatlakozás dátuma: 2008.05.26. Legújabb bejegyzések
hi Fuad,
can u plz be more clear, coz i have the same probleme of John, how i can get the current community, (current groupid)

thx
Vaibhav Mittal, módosítva 11 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

Junior Member Bejegyzések: 54 Csatlakozás dátuma: 2012.07.16. Legújabb bejegyzések
As suggested by Thiago you can use below method for groupId through themedisplay:
Long groupId = themeDisplay.getLayout().getGroupId();
thumbnail
Enrique Valdes Lacasa, módosítva 9 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

Junior Member Bejegyzések: 92 Csatlakozás dátuma: 2014.07.29. Legújabb bejegyzések
This last solution worked for me in Liferay 6.1.1 CE. The solution proposed by Thiago is deprecated by this version I believe, but it might still work. Thanks to both!
thumbnail
Bharamani P Tashildar, módosítva 6 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2014.08.27. Legújabb bejegyzések
Hi,

How can I get current groupId in post login action?

As themeDisplay object not available in Postlogin action.

Any Input?

Thanks
thumbnail
Thiago Moreira, módosítva 15 év-val korábban

RE: Re: [Liferay Forums][3. Development] Get current group ID

Liferay Legend Bejegyzések: 1449 Csatlakozás dátuma: 2007.10.10. Legújabb bejegyzések
Hi John,

Try this:

ThemeDisplay themeDisplay= (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long portletGroupId= themeDisplay.getPortletGroupdId();

Take a look at javadoc for further information.

Regards