public function activate($id)
    {
        $this->loadModel('User.Users');
        $user = $this->Users->get($id, ['fields' => ['id', 'name', 'email']]);

        if ($this->Users->updateAll(['status' => 1], ['id' => $user->id])) {
            NotificationManager::activated($user)->send();
            $this->Flash->success(__d('user', 'User {0} was successfully activated!', $user->name));
        } else {
            $this->Flash->danger(__d('user', 'User could not be activated, please try again.'));
        }

        $this->title(__d('user', 'Unblock User Account'));
        $this->redirect($this->referer());
    }
public function activate($id)
    {
        $this->loadModel('User.Users');
        $user = $this->Users->get($id, ['fields' => ['id', 'name', 'email']]);

        if ($this->Users->updateAll(['status' => 1], ['id' => $user->id])) {
            NotificationManager::activated($user)->send();
            $this->Flash->success(__d('user', 'User {0} was successfully activated!', $user->name));
        } else {
            $this->Flash->danger(__d('user', 'User could not be activated, please try again.'));
        }

        $this->title(__d('user', 'Unblock User Account'));
        $this->redirect($this->referer());
    }
public function activate ( $ id ) { $ this -> loadModel ( 'User.Users' ) ; $ user = $ this -> Users -> get ( $ id , [ 'fields' => [ 'id' , 'name' , 'email' ] ] ) ; if ( $ this -> Users -> updateAll ( [ 'status' => 1 ] , [ 'id' => $ user -> id ] ) ) { NotificationManager :: activated ( $ user ) -> send ( ) ; $ this -> Flash -> success ( __d ( 'user' , 'User {0} was successfully activated!' , $ user -> name ) ) ; } else { $ this -> Flash -> danger ( __d ( 'user' , 'User could not be activated, please try again.' ) ) ; } $ this -> title ( __d ( 'user' , 'Unblock User Account' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
Activates the given user account.

@param int $id User's ID
@return void Redirects to previous page
Activates the given user account .