I am trying to filter the web content according to the site/community name of current logged in user and below code is written in portal_normal.vm. I am using my own custom theme.I have 3 sites in my portal application ,namely,Global ,Liferay,myCustomSite.
I have default liferay user "test" as part of Liferay site, and my own user as part of "myCustomSite".
#set ($group_local_service = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService")) #set ($user_groups = $group_local_service.getUserGroups($user.getUserId())) #foreach ($user_group in $user_groups) #if ($user_group.isRegularSite()) #set ($journal_article_local_service = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService")) #set ($journal_articles = $journal_article_local_service.getArticles($user_group.getGroupId())) #foreach ($article in $journal_articles) #if($article.getStatus() ==0) #set ($VOID = $velocityPortletPreferences.setValue('groupId',$user_group.getGroupId().toString())) #set ($VOID = $velocityPortletPreferences.setValue('articleId', $article.getArticleId().toString())) #set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false')) #set ($portlet_id = '56') #set ($my_portlet_id = "${portlet_id}_INSTANCE_${article.getArticleId()}") $theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString()) $velocityPortletPreferences.reset() #end #end #end #end
When I run above code , I am able to fetch all the articles in my custom site but facing issues while dynamically adding them. I get an error like
11:06:39,420 INFO [JournalContentImpl:306] Get article display {10184, 14853, } 11:06:39,421 WARN [JournalContentImpl:317] Unable to get display for 10184 14853 en_US
"10184" is the default liferay group/site id and "14853" is my article id under my custom site.I am not sure why its using liferay site id even when I pass site id of current user.
When i checked "ThemeDisplay.getScopGroupId" ,I am always getting liferay site id back. I am using liferay 6.2 GA2. Any pointers would really help.Thanks.