Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How many ways are there to find community id in liferay
Hello all,
I want to know how to find community id . How many ways are there .
Please send the details
Thanks & regards
G.murthy
I want to know how to find community id . How many ways are there .
Please send the details
Thanks & regards
G.murthy
You can get like,
Community Id with name,
And without themeDisplay object,
Hope it will help you
ThemeDisplay themeDisplay= (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long portletGroupId= themeDisplay.getPortletGroupdId();
Community Id with name,
User user = themeDisplay.getUser();
Layout layout = themeDisplay.getLayout();
Group group = GroupLocalServiceUtil.getGroup( layout.getGroupId() );
String groupname = "";
if( group.isUser() ) groupname = user.getFullName();
if( group.isCommunity() ) groupname = group.getName();
And without themeDisplay object,
long groupId = GroupLocalServiceUtil.getGroup(communityObj.getCompanyId(), "Guest").getGroupId();Hope it will help you
cou can get community id too by simply using long communityId =
regards
PortalUtil.getScopeGroupId(request)regards
Hey
Thanks to all who gave reply
Regards,
G.murthy
Thanks to all who gave reply
Regards,
G.murthy
One more, if you have reference to themeDisplay:
themeDisplay.getScopeGroupId()
Regards,
Jay.
themeDisplay.getScopeGroupId()
Regards,
Jay.