public function editAction()
 {
     $model = new Default_Model_User();
     $form = new Default_Form_User();
     $form->removeElement('handle');
     $request = $this->getRequest();
     $id = $request->getParam('id');
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $data = $form->getValues();
             if ($data['password'] !== $data['password_again']) {
                 $this->addErrorMessage('Passwords do not match, please try again.');
                 $this->_redirect('/user/edit/id/' . $data['id']);
             }
             // Save data
             $model->update($data, $id);
             $this->addMessage('User updated.');
             $this->_redirect('/user/edit/id/' . $id);
         }
     } else {
         $user = $model->getUser($id);
         $this->view->handle = isset($user['handle']) ? $user['handle'] : false;
     }
     $this->view->form = $form;
 }
Example #2
0
 public function editAction()
 {
     $model = new Default_Model_User();
     $form = new Default_Form_User();
     $form->removeElement('handle');
     $request = $this->getRequest();
     $id = $request->getParam('id');
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $data = $form->getValues();
             if ($data['password'] !== $data['password_again']) {
                 $this->addErrorMessage($this->tr->_('USER_PASSWORD_MISMATCH'));
                 $this->view->form = $form;
                 return;
             }
             // Save data
             $model->update($data, $id);
             $this->addMessage($this->tr->_('USER_UPDATE_SUCCESS'));
             $this->_redirect('/user');
         }
     } else {
         $user = $model->getUser($id);
         $this->view->handle = isset($user['handle']) ? $user['handle'] : false;
     }
     $this->view->form = $form;
 }