I want to collect the latest user information from a user model and store it in a session.
so i do it
// Before rendering function beforeRender () {
if($this->Session->check('Auth.User')) {
$this->User->recursive = -1;
$currentUser = $this->User->read(null, $this->Session->read('Auth.User.id'));
$this->set(compact('currentUser'));
}
}
It works fine until the User model appears.
When I go to the pages, it gives me an error, because User-> read does not work, since this model is not attached there.
What is the best solution for?
- I want to get the latest Loggedin user information on every page of the site.
- The latter, not Auth.User, from the session, because - when I edit the profile content, such as a name or photo. it still refers to old data that was saved when the user logged in.
- , , Stackoverflow.

?