如何列出要“记录”的社区Liferay 6 中的用户?
我正在尝试创建一个社区选择框,使访问者能够跳转到打开的 Liferay 社区。然而,它似乎只适用于经过身份验证的用户。那么我如何向所有用户(包括注销的用户)列出“开放”社区?
这是我当前的代码
#set ($myPlaces = $user.getMyPlaces())
#if($listTool.size($myPlaces) > 0)
<select id="communitySelector">
#foreach ($myPlace IN $myPlaces)
#if ($myPlace.isCommunity())
#set ($myPlaceURL = ${myPlace.getFriendlyURL()})
## Only link if theres pages
#if ($myPlace.hasPublicLayouts())
## Prefix web for 'public'
#set ($myPlaceURL = "${public_pages_url}${myPlaceURL}")
## Select if current community
#set($commSelected = "")
#if($themeDisplay.getLayout().getGroup().getName() == $myPlace.getName())
#set($commSelected = " selected='selected' ")
#end
<option $commSelected value="${portal_url}${myPlaceURL.toString()}">$myPlace.getName()</option>
#end
#end
#end
</select>
#end
im trying to create a community select box to enable visitors to jump to open Liferay communities. However it only seems to work for authenticated users. So how I can list 'open' communities to all users including logged out users?
Here's my current code
#set ($myPlaces = $user.getMyPlaces())
#if($listTool.size($myPlaces) > 0)
<select id="communitySelector">
#foreach ($myPlace IN $myPlaces)
#if ($myPlace.isCommunity())
#set ($myPlaceURL = ${myPlace.getFriendlyURL()})
## Only link if theres pages
#if ($myPlace.hasPublicLayouts())
## Prefix web for 'public'
#set ($myPlaceURL = "${public_pages_url}${myPlaceURL}")
## Select if current community
#set($commSelected = "")
#if($themeDisplay.getLayout().getGroup().getName() == $myPlace.getName())
#set($commSelected = " selected='selected' ")
#end
<option $commSelected value="${portal_url}${myPlaceURL.toString()}">$myPlace.getName()</option>
#end
#end
#end
</select>
#end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
按照回答我自己的 Liferay 问题的悠久传统,这里是我想出的解决方案的代码片段,用于向所有用户(包括公共/来宾注销用户)列出社区
编辑 - 这是其他人发布的类似片段 https://stackoverflow.com/a/8457759/417933
In the long tradition of answering my own Liferay questions here is the code snippet for the solution I came up with for listing Communities to all users including the public/guest logged out users
EDIT - Here's a similar snippet someone else posted https://stackoverflow.com/a/8457759/417933