How can i retrieve the user id of a user who has recently register.. in CakePHP 2.1 ie
right now, user with name poo
entered some registeration credentials
like username
and password
and
database structure is below
users
id Auto_Increment
username
password
now, once the user is created , i want to display a message to user as
You have registered successfully and you id is xxx these xxx are integer number
Code for register.ctp view
echo $this->Form->create('User');
echo $this->Form->input('first_name', array('label'=>'First Name'));
echo $this->Form->end('Register');
Code for controller
public function register(){
if ($this->request->is('post')){
if ($this->User->save($this->request->data)){
// $this->Session->setFlash('User is created' . $this->YourModel->id);
$this->Session->setFlash(__('You have registered successfully and your ID is %s', $this->YourModel->id));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash('Cannot register a user');
}
}
}