Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function profileAction() {
- $request = $this->getRequest();
- $user = new Stage5_Model_User();
- $user->loadByUserName($this->view->username);
- $profileForm = new Stage5_Form_Profile(array('user' => $user));
- $profileForm->setAction($this->view->url());
- //$profileForm->getElement('userid')->setValue($user->getId());
- //$profileForm->getElement('role')->setValue($user->getRole());
- $profileForm->getElement('inlognaam')->setValue($user->getUserName());
- $profileForm->getElement('paswoord1')->setValue('');
- $profileForm->getElement('voornaam')->setValue($user->getFirstName());
- $profileForm->getElement('achternaam')->setValue($user->getLastName());
- $profileForm->getElement('email')->setValue($user->getEmail());
- //$profileForm->getElement('pic')->setValue($user->getImage());
- $this->view->picture = $user->getImage();
- $this->view->form = $profileForm;
- if ($request->isPost()) {
- if ($profileForm->isValid($request->getPost())) {
- // do your handling here
- $userid = $user->getId();
- $role = $user->getRole();
- $inlognaam = $profileForm->getElement('inlognaam')->getValue();
- $paswoord = $profileForm->getElement('paswoord1')->getValue();
- $voornaam = $profileForm->getElement('voornaam')->getValue();
- $achternaam = $profileForm->getElement('achternaam')->getValue();
- $email = $profileForm->getElement('email')->getValue();
- $image = $profileForm->getElement('pic')->getValue();
- $user->setId($userid);
- $user->setUserName($inlognaam);
- if ($paswoord != '') $user->setPassword($paswoord, true);
- $user->setFirstName($voornaam);
- $user->setLastName($achternaam);
- $user->setEmail($email);
- $user->setRole($role);
- if ($image) $user->setImage($image);
- $user->save();
- $this->_forward('succes', 'user', 'default', array('page' => 'profile'));
- }
- }
- }
Add Comment
Please, Sign In to add comment