public function sendActivationMail($id = null)
    {
        $user = $this->Users->get($id, [
            'contain' => []
        ]);

        $user->set('active', false);
        $user->set('activation_key', $this->Users->generateActivationKey());

        if ($this->Users->save($user)) {
            $this->EmailListener->activation($user);
            $this->Flash->success(__('The e-mail has been sent.'));
            return $this->redirect($this->referer());
        } else {
            $this->Flash->error(__('The e-mail could not be sent. Please, try again.'));
        }
    }
public function sendActivationMail($id = null)
    {
        $user = $this->Users->get($id, [
            'contain' => []
        ]);

        $user->set('active', false);
        $user->set('activation_key', $this->Users->generateActivationKey());

        if ($this->Users->save($user)) {
            $this->EmailListener->activation($user);
            $this->Flash->success(__('The e-mail has been sent.'));
            return $this->redirect($this->referer());
        } else {
            $this->Flash->error(__('The e-mail could not be sent. Please, try again.'));
        }
    }
public function sendActivationMail ( $ id = null ) { $ user = $ this -> Users -> get ( $ id , [ 'contain' => [ ] ] ) ; $ user -> set ( 'active' , false ) ; $ user -> set ( 'activation_key' , $ this -> Users -> generateActivationKey ( ) ) ; if ( $ this -> Users -> save ( $ user ) ) { $ this -> EmailListener -> activation ( $ user ) ; $ this -> Flash -> success ( __ ( 'The e-mail has been sent.' ) ) ; return $ this -> redirect ( $ this -> referer ( ) ) ; } else { $ this -> Flash -> error ( __ ( 'The e-mail could not be sent. Please, try again.' ) ) ; } }
Send Activation Mail method

Method to unactivate a specific user and send a new activation-mail.

@param int $id User id.
@return void|\Cake\Network\Response
Send Activation Mail method