original_string: 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());
      }
code: 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());
      }
code_tokens: 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 ( ) ) ; }
docstring: Activates the given user account.
  
  @param int $id User's ID
  @return void Redirects to previous page
docstring_tokens: Activates the given user account .