Beispiel #1
0
 public function deleteGroup()
 {
     require_once JPATH_ROOT . '/components/com_community/libraries/featured.php';
     require_once JPATH_ROOT . '/components/com_community/defines.community.php';
     $featured = new CFeatured(FEATURED_GROUPS);
     $groupWithError = array();
     $group = JTable::getInstance('Group', 'CTable');
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $id = $jinput->post->get('cid', '', 'NONE');
     //JRequest::getVar( 'cid' , '' , 'post' );
     if (empty($id)) {
         JError::raiseError('500', JText::_('COM_COMMUNITY_INVALID_ID'));
     }
     foreach ($id as $data) {
         require_once JPATH_ROOT . '/components/com_community/models/groups.php';
         //delete group bulletins
         CommunityModelGroups::deleteGroupBulletins($data);
         //delete group members
         CommunityModelGroups::deleteGroupMembers($data);
         //delete group wall
         CommunityModelGroups::deleteGroupWall($data);
         //delete group discussions
         CommunityModelGroups::deleteGroupDiscussions($data);
         //delete group media files
         CommunityModelGroups::deleteGroupMedia($data);
         //load group data before delete
         $group->load($data);
         $groupData = $group;
         //delete group avatar.
         jimport('joomla.filesystem.file');
         if (!empty($groupData->avatar)) {
             //images/avatar/groups/d203ccc8be817ad5b6a8335c.png
             $path = explode('/', $groupData->avatar);
             $file = JPATH_ROOT . '/' . $path[0] . '/' . $path[1] . '/' . $path[2] . '/' . $path[3];
             if (file_exists($file)) {
                 JFile::delete($file);
             }
         }
         if (!empty($groupData->thumb)) {
             //images/avatar/groups/thumb_d203ccc8be817ad5b6a8335c.png
             $path = explode('/', $groupData->thumb);
             $file = JPATH_ROOT . '/' . $path[0] . '/' . $path[1] . '/' . $path[2] . '/' . $path[3];
             if (file_exists($file)) {
                 JFile::delete($file);
             }
         }
         if (!$group->delete($data)) {
             array_push($groupWithError, $data . ':' . $groupData->name);
         }
         $featured->delete($data);
     }
     $message = '';
     if (empty($error)) {
         $message = JText::_('COM_COMMUNITY_GROUP_DELETED');
     } else {
         $error = implode(',', $groupWithError);
         $message = JText::sprintf('COM_COMMUNITY_GROUPS_DELETE_GROUP_ERROR', $error);
     }
     $mainframe = JFactory::getApplication();
     $mainframe->redirect('index.php?option=com_community&view=groups', $message, 'message');
 }
Beispiel #2
0
 static function removeJSGroup($name)
 {
     if (file_exists(JPATH_ADMINISTRATOR . '/components/com_community/tables/cache.php')) {
         require_once JPATH_ADMINISTRATOR . 'components/com_community/tables/cache.php';
     }
     require_once JPATH_SITE . '/components/com_community/libraries/core.php';
     require_once JPATH_SITE . '/components/com_community/models/groups.php';
     $group_id = JoomdleHelperGroups::get_js_group_by_name($name);
     CommunityModelGroups::deleteGroupBulletins($group_id);
     CommunityModelGroups::deleteGroupMembers($group_id);
     CommunityModelGroups::deleteGroupWall($group_id);
     CommunityModelGroups::deleteGroupDiscussions($group_id);
     CommunityModelGroups::deleteGroupMedia($group_id);
     $group = JTable::getInstance('Group', 'CTable');
     $group->load($group_id);
     $group->delete($group_id);
     return "OK";
 }
Beispiel #3
0
 /**
  * Update internal list of groups this user is a member of
  * Run only when user is logged in
  */
 public function updateGroupList($forceUpdate = false)
 {
     $my = CFactory::getUser();
     if ($my->id == $this->id || $forceUpdate) {
         if (!class_exists('CommunityModelGroups')) {
             $groupModel = CFactory::getModel('groups');
         } else {
             $groupModel = new CommunityModelGroups();
         }
         $groupsIds = $groupModel->getGroupIds($this->id);
         if ($groupsIds) {
             $groupsIds = implode(',', $groupsIds);
             if ($this->_groups != $groupsIds) {
                 $this->_groups = $groupsIds;
                 $this->save();
             }
         } elseif (empty($groupsIds)) {
             $this->_groups = '';
             $this->save();
         }
     }
 }
Beispiel #4
0
 /**
  *  Ajax function to delete a group
  *
  * @param	$groupId	The specific group id to unpublish
  **/
 public function ajaxDeleteGroup($groupId, $step = 1)
 {
     $response = new JAXResponse();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'owner');
     CFactory::load('models', 'groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $groupModel = CFactory::getModel('groups');
     $membersCount = $groupModel->getMembersCount($groupId);
     $my = CFactory::getUser();
     $isMine = $my->id == $group->ownerid;
     if (!COwnerHelper::isCommunityAdmin() && !($isMine && $membersCount <= 1)) {
         $content = JText::_('CC NOT ALLOWED TO DELETE GROUP');
         $buttons = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('CC CANCEL') . '"/>';
         $response->addScriptCall('cWindowResize', 100);
         $response->addAssign('cWindowContent', 'innerHTML', $content);
         $response->addScriptCall('cWindowActions', $buttons);
     } else {
         $response->addScriptCall('cWindowResize', 160);
         $doneMessage = ' - <span class=\'success\'>' . JText::_('CC DONE') . '</span><br />';
         $failedMessage = ' - <span class=\'failed\'>' . JText::_('CC FAILED') . '</span><br />';
         switch ($step) {
             case 1:
                 // Nothing gets deleted yet. Just show a messge to the next step
                 if (empty($groupId)) {
                     $content = JText::_('CC INVALID GROUP ID');
                 } else {
                     $content = '<strong>' . JText::sprintf('CC DELETING GROUP', $group->name) . '</strong><br/>';
                     $content .= JText::_('CC DELETING GROUP BULLETIN');
                     $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 2);');
                     //trigger for onBeforeGroupDelete
                     $this->triggerGroupEvents('onBeforeGroupDelete', $group);
                 }
                 $response->addAssign('cWindowContent', 'innerHTML', $content);
                 break;
             case 2:
                 // Delete all group bulletins
                 if (CommunityModelGroups::deleteGroupBulletins($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP MEMBERS');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 3);');
                 break;
             case 3:
                 // Delete all group members
                 if (CommunityModelGroups::deleteGroupMembers($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP WALLS');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 4);');
                 break;
             case 4:
                 // Delete all group wall
                 if (CommunityModelGroups::deleteGroupWall($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP DISCUSSIONS');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 5);');
                 break;
             case 5:
                 // Delete all group discussions
                 if (CommunityModelGroups::deleteGroupDiscussions($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP MEDIA');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 6);');
                 break;
             case 6:
                 // Delete all group's media files
                 if (CommunityModelGroups::deleteGroupMedia($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 7);');
                 break;
             case 7:
                 // Delete group
                 $group =& JTable::getInstance('Group', 'CTable');
                 $group->load($groupId);
                 $groupData = $group;
                 if ($group->delete($groupId)) {
                     CFactory::load('libraries', 'featured');
                     $featured = new CFeatured(FEATURED_GROUPS);
                     $featured->delete($groupId);
                     jimport('joomla.filesystem.file');
                     //@rule: Delete only thumbnail and avatars that exists for the specific group
                     if ($groupData->avatar != "components/com_community/assets/group.jpg" && !empty($groupData->avatar)) {
                         $path = explode('/', $groupData->avatar);
                         $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                         if (JFile::exists($file)) {
                             JFile::delete($file);
                         }
                     }
                     if ($groupData->thumb != "components/com_community/assets/group_thumb.jpg" && !empty($groupData->thumb)) {
                         $path = explode('/', $groupData->thumb);
                         $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                         if (JFile::exists($file)) {
                             JFile::delete($file);
                         }
                     }
                     $html = '<div class=\\"info\\" style=\\"display: none;\\">' . JText::_('CC GROUP DELETED') . '</div>';
                     $response->addScriptCall('joms.jQuery("' . $html . '").prependTo("#community-wrap").fadeIn();');
                     $response->addScriptCall('joms.jQuery("#community-groups-wrap").fadeOut();');
                     $content = JText::_('CC GROUP DELETED');
                     //trigger for onGroupDelete
                     $this->triggerGroupEvents('onAfterGroupDelete', $groupData);
                     // Remove from activity stream
                     CActivityStream::remove('groups', $groupId);
                 } else {
                     $content = JText::_('CC ERROR WHILE DELETING GROUP');
                 }
                 $redirect = CRoute::_(JURI::root() . 'index.php?option=com_community&view=groups');
                 $buttons = '<input type="button" class="button" id="groupDeleteDone" onclick="cWindowHide(); window.location=\'' . $redirect . '\';" value="' . JText::_('Done') . '"/>';
                 $response->addAssign('cWindowContent', 'innerHTML', $content);
                 $response->addScriptCall('cWindowActions', $buttons);
                 $response->addScriptCall('cWindowResize', 100);
                 break;
             default:
                 break;
         }
     }
     return $response->sendResponse();
 }
Beispiel #5
0
 /**
  *  Ajax function to delete a group
  *
  * @param	$groupId	The specific group id to unpublish
  **/
 public function ajaxDeleteGroup($groupId, $step = 1)
 {
     $filter = JFilterInput::getInstance();
     $groupId = $filter->clean($groupId, 'int');
     $step = $filter->clean($step, 'int');
     $response = new JAXResponse();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'owner');
     CFactory::load('models', 'groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $groupModel = CFactory::getModel('groups');
     $membersCount = $groupModel->getMembersCount($groupId);
     $my = CFactory::getUser();
     // @rule: Do not allow anyone that tries to be funky!
     if (!$my->authorise('community.delete', 'groups.' . $groupId, $group)) {
         $content = JText::_('COM_COMMUNITY_GROUPS_NOT_ALLOWED_DELETE');
         $buttons = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_CANCEL') . '"/>';
         $response->addScriptCall('cWindowAddContent', $content, $buttons);
         return $response->sendResponse();
     }
     $doneMessage = ' - <span class=\'success\'>' . JText::_('COM_COMMUNITY_DONE') . '</span><br />';
     $failedMessage = ' - <span class=\'failed\'>' . JText::_('COM_COMMUNITY_FAILED') . '</span><br />';
     $childId = 0;
     switch ($step) {
         case 1:
             // Nothing gets deleted yet. Just show a messge to the next step
             if (empty($groupId)) {
                 $content = JText::_('COM_COMMUNITY_GROUPS_ID_NOITEM');
             } else {
                 $content = '<strong>' . JText::sprintf('COM_COMMUNITY_GROUPS_DELETE_GROUP', $group->name) . '</strong><br/>';
                 $content .= JText::_('COM_COMMUNITY_GROUPS_DELETE_BULLETIN');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 2);');
                 //trigger for onBeforeGroupDelete
                 $this->triggerGroupEvents('onBeforeGroupDelete', $group);
             }
             $response->addScriptCall('cWindowAddContent', $content);
             break;
         case 2:
             CommunityModelGroups::getGroupChildId($groupId);
             // Delete all group bulletins
             if (CommunityModelGroups::deleteGroupBulletins($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_DELETE_GROUP_MEMBERS');
             $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
             $response->addScriptCall('cWindowResize(joms.jQuery("#cWindowContentWrap").height()+10);');
             $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 3);');
             break;
         case 3:
             // Delete all group members
             if (CommunityModelGroups::deleteGroupMembers($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_WALLS_DELETE');
             $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
             $response->addScriptCall('cWindowResize(joms.jQuery("#cWindowContentWrap").height()+10);');
             $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 4);');
             break;
         case 4:
             // Delete all group wall
             if (CommunityModelGroups::deleteGroupWall($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_DISCUSSIONS_DELETEL');
             $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
             $response->addScriptCall('cWindowResize(joms.jQuery("#cWindowContentWrap").height()+10);');
             $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 5);');
             break;
         case 5:
             // Delete all group discussions
             if (CommunityModelGroups::deleteGroupDiscussions($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_DELETE_MEDIA');
             $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
             $response->addScriptCall('cWindowResize(joms.jQuery("#cWindowContentWrap").height()+10);');
             $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 6);');
             break;
         case 6:
             // Delete all group's media files
             if (CommunityModelGroups::deleteGroupMedia($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
             $response->addScriptCall('cWindowResize(joms.jQuery("#cWindowContentWrap").height()+10);');
             $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 7);');
             break;
         case 7:
             // Delete group
             $group =& JTable::getInstance('Group', 'CTable');
             $group->load($groupId);
             $groupData = $group;
             if ($group->delete($groupId)) {
                 CFactory::load('libraries', 'featured');
                 $featured = new CFeatured(FEATURED_GROUPS);
                 $featured->delete($groupId);
                 jimport('joomla.filesystem.file');
                 //@rule: Delete only thumbnail and avatars that exists for the specific group
                 if ($groupData->avatar != "components/com_community/assets/group.jpg" && !empty($groupData->avatar)) {
                     $path = explode('/', $groupData->avatar);
                     $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                     if (JFile::exists($file)) {
                         JFile::delete($file);
                     }
                 }
                 if ($groupData->thumb != "components/com_community/assets/group_thumb.jpg" && !empty($groupData->thumb)) {
                     $path = explode('/', $groupData->thumb);
                     $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                     if (JFile::exists($file)) {
                         JFile::delete($file);
                     }
                 }
                 $html = '<div class=\\"info\\" style=\\"display: none;\\">' . JText::_('COM_COMMUNITY_GROUPS_DELETED') . '</div>';
                 $response->addScriptCall('joms.jQuery("' . $html . '").prependTo("#community-wrap").fadeIn();');
                 $response->addScriptCall('joms.jQuery("#community-groups-wrap").fadeOut();');
                 $content = JText::_('COM_COMMUNITY_GROUPS_DELETED');
                 //trigger for onGroupDelete
                 $this->triggerGroupEvents('onAfterGroupDelete', $groupData);
             } else {
                 $content = JText::_('COM_COMMUNITY_GROUPS_DELETE_ERROR');
             }
             $redirect = CRoute::_(JURI::root() . 'index.php?option=com_community&view=groups');
             $buttons = '<input type="button" class="button" id="groupDeleteDone" onclick="cWindowHide(); window.location=\'' . $redirect . '\';" value="' . JText::_('COM_COMMUNITY_DONE_BUTTON') . '"/>';
             $response->addScriptCall('cWindowAddContent', $content, $buttons);
             break;
         default:
             break;
     }
     //Clear Cache for groups
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_FRONTPAGE, COMMUNITY_CACHE_TAG_GROUPS, COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_GROUPS_CAT, COMMUNITY_CACHE_TAG_ACTIVITIES));
     return $response->sendResponse();
 }
Beispiel #6
0
 /**
  *  Ajax function to delete a group
  *
  * @param	$groupId	The specific group id to unpublish
  * */
 public function ajaxDeleteGroup($groupId, $step = 1)
 {
     $filter = JFilterInput::getInstance();
     $groupId = $filter->clean($groupId, 'int');
     $step = $filter->clean($step, 'int');
     $json = array();
     $response = new JAXResponse();
     $group = JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $groupModel = CFactory::getModel('groups');
     $membersCount = $groupModel->getMembersCount($groupId);
     $my = CFactory::getUser();
     // @rule: Do not allow anyone that tries to be funky!
     if (!$my->authorise('community.delete', 'groups.' . $groupId, $group)) {
         $json['error'] = JText::_('COM_COMMUNITY_GROUPS_NOT_ALLOWED_DELETE');
         die(json_encode($json));
     }
     $doneMessage = ' - <span class=\'success\'>' . JText::_('COM_COMMUNITY_DONE') . '</span><br />';
     $failedMessage = ' - <span class=\'failed\'>' . JText::_('COM_COMMUNITY_FAILED') . '</span><br />';
     $childId = 0;
     switch ($step) {
         case 1:
             // Nothing gets deleted yet. Just show a messge to the next step
             if (empty($groupId)) {
                 $json['error'] = JText::_('COM_COMMUNITY_GROUPS_ID_NOITEM');
             } else {
                 $json['message'] = '<strong>' . JText::sprintf('COM_COMMUNITY_GROUPS_DELETE_GROUP', $group->name) . '</strong><br/>';
                 $json['message'] .= JText::_('COM_COMMUNITY_GROUPS_DELETE_BULLETIN');
                 $json['next'] = 2;
                 //trigger for onBeforeGroupDelete
                 $this->triggerGroupEvents('onBeforeGroupDelete', $group);
             }
             break;
         case 2:
             // Delete all group bulletins
             CommunityModelGroups::getGroupChildId($groupId);
             if (CommunityModelGroups::deleteGroupBulletins($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_DELETE_GROUP_MEMBERS');
             $json['message'] = $content;
             $json['next'] = 3;
             break;
         case 3:
             // Delete all group members
             if (CommunityModelGroups::deleteGroupMembers($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_WALLS_DELETE');
             $json['message'] = $content;
             $json['next'] = 4;
             break;
         case 4:
             // Delete all group wall
             if (CommunityModelGroups::deleteGroupWall($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_DISCUSSIONS_DELETEL');
             $json['message'] = $content;
             $json['next'] = 5;
             break;
         case 5:
             // Delete all group discussions
             if (CommunityModelGroups::deleteGroupDiscussions($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_GROUPS_DELETE_MEDIA');
             $json['message'] = $content;
             $json['next'] = 6;
             break;
         case 6:
             // Delete all group's media files
             if (CommunityModelGroups::deleteGroupMedia($groupId)) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $json['message'] = $content;
             $json['next'] = 7;
             break;
         case 7:
             // Delete group
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($groupId);
             $groupData = $group;
             if ($group->delete($groupId)) {
                 //CFactory::load( 'libraries' , 'featured' );
                 $featured = new CFeatured(FEATURED_GROUPS);
                 $featured->delete($groupId);
                 jimport('joomla.filesystem.file');
                 //@rule: Delete only thumbnail and avatars that exists for the specific group
                 if ($groupData->avatar != "components/com_community/assets/group.jpg" && !empty($groupData->avatar)) {
                     $path = explode('/', $groupData->avatar);
                     $file = JPATH_ROOT . '/' . $path[0] . '/' . $path[1] . '/' . $path[2] . '/' . $path[3];
                     if (JFile::exists($file)) {
                         JFile::delete($file);
                     }
                 }
                 if ($groupData->thumb != "components/com_community/assets/group_thumb.jpg" && !empty($groupData->thumb)) {
                     $path = explode('/', $groupData->thumb);
                     $file = JPATH_ROOT . '/' . $path[0] . '/' . $path[1] . '/' . $path[2] . '/' . $path[3];
                     if (JFile::exists($file)) {
                         JFile::delete($file);
                     }
                 }
                 $content = JText::_('COM_COMMUNITY_GROUPS_DELETED');
                 //trigger for onGroupDelete
                 $this->triggerGroupEvents('onAfterGroupDelete', $groupData);
             } else {
                 $content = JText::_('COM_COMMUNITY_GROUPS_DELETE_ERROR');
             }
             $redirect = CRoute::_('index.php?option=com_community&view=groups');
             $json['message'] = $content;
             $json['redirect'] = $redirect;
             $json['btnDone'] = JText::_('COM_COMMUNITY_DONE_BUTTON');
             break;
         default:
             break;
     }
     //Clear Cache for groups
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_FRONTPAGE, COMMUNITY_CACHE_TAG_GROUPS, COMMUNITY_CACHE_TAG_FEATURED, COMMUNITY_CACHE_TAG_GROUPS_CAT, COMMUNITY_CACHE_TAG_ACTIVITIES));
     die(json_encode($json));
     // return $response->sendResponse();
 }