Leave a Reply

If you need to post a piece of code use {code type=php}...{/code}.
Allowed types are "php", "mysql", "html", "js", "css".

Please do not escape your post (leave all ", <, > and & as they are!). If you have encoded characters and need to reverse ("decode") it, you can do that here!

  1. Adam

    October 8, 2015 at 17:02

    Your approach to edit own profile is an awesome hack. Thanks!

    Maybe for version difference reasons your code didnt work. Am on CakePHP 3.0. My solution:

    &gt; Controller:

    public function editme() {
            $uid = $this->request->session()->read('');
            $user = $this->Users->get($uid, []);
            if ($this->request->is(['patch', 'post', 'put'])) {
                $user = $this->Users->patchEntity($user, $this->request->data);
                if ($this->Users->save($user)) {
                    $this->Flash->success(__('Your account changes have been saved.'));
                } else {
                    $this->Flash->error(__('Something went wrong and your changes were not saved. Try again.'));
            $this->set('_serialize', ['user']);

    View template:

    Form->create($user); ?>
                echo $this->Form->input('last_name');
                echo $this->Form->input('email');
                echo $this->Form->input('password');
                echo $this->Form->hidden('active', [
                  'default' => '1'