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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -