retrieving user id in cakephp view -
i'm trying retrieve user id in cakephp view, what's best practise achieve that? since auth->user('id')
usable in controller, what's used in views?
edit :
i fixed using in controller:
$id = $this->auth->user('id'); $this->set("user_id",$id);
then in view of controller retrieve $user_id.
use session helper.
var $helpers = array('session'); // controller // view $this->session->read('auth.user'); // returns complete user record $this->session->read('auth.user.email'); // returns email logged in user
Comments
Post a Comment