/** * Create a group */ public function creategroupAction() { $this->buildMenu(true); $request = $this->getRequest(); $Profiles = new Application_Model_Profiles(); $profile_form = new Application_Form_AddGroup(); $this->view->profile_form = $profile_form; if ($request->isPost() && $profile_form->isValid($_POST)) { if ($Profiles->getProfile($profile_form->getValue('name'), true)) { $profile_form->getElement('name')->setErrors(array(Zend_Registry::get('Zend_Translate')->translate('This username is not available'))); return; } $profile = $Profiles->createRow(); $profile->owner = Zend_Auth::getInstance()->getIdentity()->id; $profile->name = $profile_form->getValue('name'); $profile->screen_name = $profile_form->getValue('screen_name'); $profile->profile_privacy = $profile_form->getValue('profile_privacy'); $Profiles->createNewGroup($profile); $ProfilesMeta = new Application_Model_ProfilesMeta(); $ProfilesMeta->metaUpdate('description', $profile_form->getValue('description'), $profile->id); Application_Plugin_Alerts::success($this->view->translate('New group created')); $this->redirect('editprofile/listgroups'); } }