public function editAction() { $authorization = Zend_Auth::getInstance(); $identity = $authorization->getIdentity(); if ($identity) { $form = new Application_Form_Profile(); $model = new Application_Model_Users(); $id = $this->getRequest()->getParam('id'); $user_data = $model->getUserById($id); $form->populate($user_data); // $form->getElement('password')->setValue($user_data[0]['password']); // $form->getElement('re_password')->setValue($user_data[0]['password']); if ($identity->user_type == "admin") { if ($this->getRequest()->isPost()) { $form->getElement('id')->setValue($id); if ($form->isValid($this->getRequest()->getParams())) { $model = new Application_Model_Users(); $form->removeElement("re_password"); $model->editUser($form->getValues(), $id); //$this->view->identity->id $this->redirect("/users/list"); } } } else { $form->removeElement("user_type"); $form->removeElement("active"); if ($this->getRequest()->isPost()) { $form->getElement('id')->setValue($id); if ($form->isValid($this->getRequest()->getParams())) { $model = new Application_Model_Users(); $form->removeElement("re_password"); $model->editUser($form->getValues(), $id); //$this->view->identity->id $this->redirect("categories/list"); } } } $this->view->form = $form; //$this->render("add"); } else { $this->redirect("/users/login"); } }