Foros de discusión

Allow communities with the same name

thumbnail
Dominik domih, modificado hace 12 años.

Allow communities with the same name

Junior Member Mensajes: 57 Fecha de incorporación: 10/11/08 Mensajes recientes
Hi there,

I have a problem in creating a community with the same name as an already existing one. The portal says: "Please enter a unique name."
I want to create communities where the name of the community can be non-unique. In other words I want to disable unique name for communities. Is this possible?

Thanks for any tipps!!
thumbnail
srikanth a, modificado hace 12 años.

RE: Allow communities with the same name

Regular Member Mensajes: 144 Fecha de incorporación: 21/02/11 Mensajes recientes
Dominik domih:
Hi there,

I have a problem in creating a community with the same name as an already existing one. The portal says: "Please enter a unique name."
I want to create communities where the name of the community can be non-unique. In other words I want to disable unique name for communities. Is this possible?

Thanks for any tipps!!



Hi,
I personally don't think that creating a duplicate communities is a good idea. If your requirements insists you to do that then i think you need change the service.xml of OOB portlet. Lets hope any one else give some other good idea.

regards
Sri
thumbnail
Dominik domih, modificado hace 12 años.

RE: Allow communities with the same name

Junior Member Mensajes: 57 Fecha de incorporación: 10/11/08 Mensajes recientes
Hi Sri, first let me thank you for your suggestion. I was hoping that the groupId would be enough for unique identification. To solve it I try to work around it by composing a name out of the descriptions values (there are name, date and time available... )

Best regards, Dominik
thumbnail
Sandeep Nair, modificado hace 12 años.

RE: Allow communities with the same name

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
I think the problem is with friendly url. like when you create a community name, it creates a friendly url based on name. For example Guest community has friendly url of /web/guest/ for public pages. If there were 2 Guest communities, how would it uniquely identify. I think that may be the reason, you cant have communities having same name in Liferay

Regards,
Sandeep
thumbnail
Dominik domih, modificado hace 12 años.

RE: Allow communities with the same name

Junior Member Mensajes: 57 Fecha de incorporación: 10/11/08 Mensajes recientes
Thanks for your feedback, Sandeep. I came to the same question if it depends on the friendly-urls, but now I create communities with a timestamp in the name of the community. e.g. m1_some-great-community_01.12.2011_11:00 . The ":" in the community name makes liferay to fallback from friendly URL to some ID-URL e.g. /web/32412
So it is not directly linked with the friendly-url feature.
Thanks anyway emoticon

So as you can see, my solution was to provide the user with multiple fields when creating a community. Those fields are now concatenated to create a unique name.
thumbnail
Sandeep Nair, modificado hace 12 años.

RE: Allow communities with the same name

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
Hmm,

Interesting i was checking when does it show that message and saw if there is a DuplicateGroupNameException coming then the above error message that you see is displayed. The logic where it throws this exception is in GroupLocalServiceImpl in its update method(liferay calls update in both add/update) and here is the logic

protected void validateName(long groupId, long companyId, String name)
		throws PortalException, SystemException {

		if ((Validator.isNull(name)) || (Validator.isNumber(name)) ||
			(name.indexOf(CharPool.STAR) != -1)) {

			throw new GroupNameException();
		}

		try {
			Group group = groupFinder.findByC_N(companyId, name);

			if ((groupId <= 0) || (group.getGroupId() != groupId)) {
				throw new DuplicateGroupException();
			}
		}
		catch (NoSuchGroupException nsge) {
		}
	}


If you can bypass that validation then you should be able to create multiple group with same name but i dont know what would be the further complications or after effects if you bypass that and allow two groups having same names. Until now my strong belief was it was restricting the same for friendly url

Regards,
Sandeep