留言板

How can I get a friendly url of an organization?

David Haber,修改在13 年前。

How can I get a friendly url of an organization?

New Member 帖子: 5 加入日期: 10-7-4 最近的帖子
Hi,

I am trying to redirect all my users to their community start page.


List<organization> organizations = user.getOrganizations();
// Get name of first organization
String orgName = organizations.get(0).getName();
path = "/web/" + orgName + "/home";
</organization>


This works fine as long as the name is equal to the friendly url of the organization. However if my organization is called "Liferay Inc." for example, the friendly url will be different as the name consists of two words. The redirection does not work anymore.

How can I get the friendly url of an organization or is there any way around this?

Thank you for your help. emoticon
thumbnail
Dong-Jun Kim,修改在13 年前。

RE: How can I get a friendly url of an organization?

Junior Member 帖子: 61 加入日期: 09-12-23 最近的帖子
You can use group object since you can get groupId from organization as well


GroupLocalServiceUtil.getGroup(0).getFriendlyURL()


You can get better idea about how Liferay's friendly url is formed if you look at Group_ table in your liferay database. It will show you all friendly url's for all groups (communities and organizations).
Hope this helps.

Cheers.
Dwayne McFarlane,修改在12 年前。

RE: How can I get a friendly url of an organization?

New Member 发布: 1 加入日期: 11-5-9 最近的帖子
You can get the group object from the organization object
String friendlyUrl = organizations.get(0).getGroup().getFriendlyURL();