掲示板
How to get user's private page url
12年前 に Tejas Kanani によって更新されました。
How to get user's private page url
Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
Hi,
How can we get user's private page url?
Like, if we need user's public home page then we can use user.getDisplayURL(themeDisplay).
Do we have any such method for getting user's private page url ?
How can we get user's private page url?
Like, if we need user's public home page then we can use user.getDisplayURL(themeDisplay).
Do we have any such method for getting user's private page url ?
12年前 に Anil Sunkari によって更新されました。
RE: How to get user's private page url
Expert 投稿: 427 参加年月日: 09/08/12 最新の投稿
If you are looking to get the private url only when user is existed on that page.....So,you can achieve it through themeDisplay.getURLCurrent() i hope.Correct me if you thinking of other scenario.
12年前 に Sandeep Nair によって更新されました。
RE: How to get user's private page url
Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿Tejas Kanani:
Hi,
How can we get user's private page url?
Like, if we need user's public home page then we can use user.getDisplayURL(themeDisplay).
Do we have any such method for getting user's private page url ?
Hi Tejas,
If you see UserImpl where this getDisplayURL is implemented the logic is written for fetching the public page
public String getDisplayURL(String portalURL, String mainPath)
throws PortalException, SystemException {
if (isDefaultUser()) {
return StringPool.BLANK;
}
Group group = getGroup();
int publicLayoutsPageCount = group.getPublicLayoutsPageCount();
if (publicLayoutsPageCount > 0) {
StringBundler sb = new StringBundler(5);
sb.append(portalURL);
sb.append(mainPath);
sb.append("/my_places/view?groupId=");
sb.append(group.getGroupId());
sb.append("&privateLayout=0");
return sb.toString();
}
return StringPool.BLANK;
}
Just do the same for private ones. by passing privateLayout=1 and checking the condition privateLayoutsPageCount>0
Regards,
Sandeep
12年前 に Tejas Kanani によって更新されました。
RE: How to get user's private page url
Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
Thanks Sandeep.
Its exactly same what I am looking for.
Its exactly same what I am looking for.
11年前 に Cas Stigter によって更新されました。
RE: How to get user's private page url
New Member 投稿: 5 参加年月日: 11/06/28 最新の投稿
Hi,
I know you found a solution, I just wanted to add an example that doesn't use strings concatenation.
I used this in a post login hook where ThemeDisplay isn't available.
I know you found a solution, I just wanted to add an example that doesn't use strings concatenation.
public void run(HttpServletRequest request, HttpServletResponse response)
throws ActionException {
String path = "";
// attempt to get path to User private page
User user = UserLocalServiceUtil.getUser(PortalUtil.getUserId(request));
// check for private layouts
if (LayoutLocalServiceUtil.hasLayouts(user, true)) {
List<layout> layouts = LayoutLocalServiceUtil.getLayouts(user.getGroupId(), true);
if (layouts.size()>1){
_log.info("More then 1 private layout found for User while max. 1 is assumed. The last layout is returned.");
}
for (Layout layout : layouts) {
path = PortalUtil.getLayoutActualURL(layout);
}
}
if (Validator.isNotNull(path)) {
LastPath lastPath = new LastPath(StringPool.BLANK, path,new HashMap<string, string[]>());
HttpSession session = request.getSession();
session.setAttribute(WebKeys.LAST_PATH, lastPath);
}
}
</string,></layout>
I used this in a post login hook where ThemeDisplay isn't available.
11年前 に Juan Fernández によって更新されました。
RE: How to get user's private page url
Liferay Legend 投稿: 1261 参加年月日: 08/10/02 最新の投稿
10年前 に sachin maheshwari によって更新されました。
RE: How to get user's private page url
Junior Member 投稿: 52 参加年月日: 10/12/04 最新の投稿
This is the one i am looking for sort and simple.