public function edit($id)
    {
        $this->loadModel('User.Users');
        $user = $this->Users->get($id, ['contain' => ['Roles']]);
        $languages = LocaleToolbox::languagesList();
        $roles = $this->Users->Roles->find('list', [
            'conditions' => [
                'id NOT IN' => [ROLE_ID_AUTHENTICATED, ROLE_ID_ANONYMOUS]
            ]
        ]);

        if ($this->request->data()) {
            $user->accessible(['id', 'username'], false);
            $user = $this->Users->patchEntity($user, $this->request->data);
            if ($this->Users->save($user)) {
                $this->Flash->success(__d('user', 'User information successfully updated!'));
                $this->redirect($this->referer());
            } else {
                $this->Flash->danger(__d('user', 'User information could not be saved, please check your information.'));
            }
        }

        $this->title(__d('user', 'Editing User'));
        $this->set(compact('user', 'roles', 'languages'));
        $this->Breadcrumb->push('/admin/user/manage');
    }
public function edit($id)
    {
        $this->loadModel('User.Users');
        $user = $this->Users->get($id, ['contain' => ['Roles']]);
        $languages = LocaleToolbox::languagesList();
        $roles = $this->Users->Roles->find('list', [
            'conditions' => [
                'id NOT IN' => [ROLE_ID_AUTHENTICATED, ROLE_ID_ANONYMOUS]
            ]
        ]);

        if ($this->request->data()) {
            $user->accessible(['id', 'username'], false);
            $user = $this->Users->patchEntity($user, $this->request->data);
            if ($this->Users->save($user)) {
                $this->Flash->success(__d('user', 'User information successfully updated!'));
                $this->redirect($this->referer());
            } else {
                $this->Flash->danger(__d('user', 'User information could not be saved, please check your information.'));
            }
        }

        $this->title(__d('user', 'Editing User'));
        $this->set(compact('user', 'roles', 'languages'));
        $this->Breadcrumb->push('/admin/user/manage');
    }
public function edit ( $ id ) { $ this -> loadModel ( 'User.Users' ) ; $ user = $ this -> Users -> get ( $ id , [ 'contain' => [ 'Roles' ] ] ) ; $ languages = LocaleToolbox :: languagesList ( ) ; $ roles = $ this -> Users -> Roles -> find ( 'list' , [ 'conditions' => [ 'id NOT IN' => [ ROLE_ID_AUTHENTICATED , ROLE_ID_ANONYMOUS ] ] ] ) ; if ( $ this -> request -> data ( ) ) { $ user -> accessible ( [ 'id' , 'username' ] , false ) ; $ user = $ this -> Users -> patchEntity ( $ user , $ this -> request -> data ) ; if ( $ this -> Users -> save ( $ user ) ) { $ this -> Flash -> success ( __d ( 'user' , 'User information successfully updated!' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; } else { $ this -> Flash -> danger ( __d ( 'user' , 'User information could not be saved, please check your information.' ) ) ; } } $ this -> title ( __d ( 'user' , 'Editing User' ) ) ; $ this -> set ( compact ( 'user' , 'roles' , 'languages' ) ) ; $ this -> Breadcrumb -> push ( '/admin/user/manage' ) ; }
Edits the given user's information.

@param int $id User's ID
@return void
Edits the given user s information .