Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Similar Group Names

10 years 11 months ago
  • James's Avatar
    Topic Author
  • James
  • Offline
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0
Licenses:
JomSocial Expired

Presently in JS, you cannot create Groups with the same names.

echo - {Group name has already been taken}

I would like to change this. Is there an easy fix?

10 years 11 months ago
Licenses:
JomSocial Expired GURU Expired Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

Hi James,
If you are known a bit coding then here is a small modification of the code

1. go to root/components/com_community/models/groups.php line no 1150
are replace the code

public function groupExist($name, $id=0) {
		$db		= $this->getDBO();

		$strSQL	= 'SELECT COUNT(*) FROM '.$db->quoteName('#__community_groups')
			. ' WHERE '.$db->quoteName('name').'=' . $db->Quote( $name )
			. ' AND '.$db->quoteName('id').'!='. $db->Quote( $id ) ;


		$db->setQuery( $strSQL );
		$result	= $db->loadResult();

		if($db->getErrorNum()) {
			JError::raiseError( 500, $db->stderr());
		}

		return $result;
	}

replace by
public function groupExist($name, $id=0) {
		$db		= $this->getDBO();

		$strSQL	= 'SELECT COUNT(*) FROM '.$db->quoteName('#__community_groups')
			. ' WHERE '.$db->quoteName('name').'=' . $db->Quote( $name )
			. ' AND '.$db->quoteName('id').'!='. $db->Quote( $id ) ;


		$db->setQuery( $strSQL );
		$result	= $db->loadResult();

		if($db->getErrorNum()) {
			JError::raiseError( 500, $db->stderr());
		}

		return 0;
	}

Let me know it works or not.
Thanks

The following user(s) said Thank You: James
10 years 11 months ago
  • David's Avatar
  • David
  • Visitor
  • Thank you received: 0
Licenses:

Hi James,

you can open this file : components / com_community / controllers / groups.php
search : COM_COMMUNITY_GROUPS_NAME_TAKEN_ERROR

you will on line 1615 and 1873

change the code on from :

 if ($model->groupExist($group->name, $group->id)) {
                    $mainframe->redirect($redirect, JText::_('COM_COMMUNITY_GROUPS_NAME_TAKEN_ERROR'));
                    return;
                }

into
 // if ($model->groupExist($group->name, $group->id)) {
      //     $mainframe->redirect($redirect, JText::_('COM_COMMUNITY_GROUPS_NAME_TAKEN_ERROR'));
      //     return;
 // }

same like the other line.. just give // sign on the if statement like below :
// if ($model->groupExist($name)) {
        //     $validated = false;
        //     $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_GROUPS_NAME_TAKEN_ERROR'), 'error');
        // }

PS : This is only for frontend group created.. if you create group from backend, you still can't have same name for group.

Warm Regards,

David

10 years 11 months ago
  • James's Avatar
    Topic Author
  • James
  • Offline
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0
Licenses:
JomSocial Expired

Great. The code works perfectly, but it seems to me there is no override for groups.php. The file structure seems to fall outside of the com_community override folder.

10 years 11 months ago
Licenses:
JomSocial Expired GURU Expired Publisher Expired AdAgency Expired iSEO Expired Socialize Expired

Hi James,
I didn't understand your point.
Can you explain a bit more please?
Thanks

10 years 11 months ago
  • James's Avatar
    Topic Author
  • James
  • Offline
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0
Licenses:
JomSocial Expired

What I mean is that, If I am to create an override for groups.php, where would I place the file?

It doesn't override when I place it here:
\root\template_name\html\com_community\models\groups.php

10 years 11 months ago
  • David's Avatar
  • David
  • Visitor
  • Thank you received: 0
Licenses:

Hi James,

maybe you can read this article for override joomla components on MVC.. docs.joomla.org/How_to_override_the_comp...rom_the_Joomla!_core

Don't forget to do a backup first before changed anything on core :)

Warm Regards,

David

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW