Foros de discusión

How can I get a friendly url of an organization?

David Haber, modificado hace 13 años.

How can I get a friendly url of an organization?

New Member Mensajes: 5 Fecha de incorporación: 4/07/10 Mensajes recientes
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, modificado hace 13 años.

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

Junior Member Mensajes: 61 Fecha de incorporación: 23/12/09 Mensajes recientes
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, modificado hace 12 años.

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

New Member Mensaje: 1 Fecha de incorporación: 9/05/11 Mensajes recientes
You can get the group object from the organization object
String friendlyUrl = organizations.get(0).getGroup().getFriendlyURL();