is $this-Auth-user('id') really that difficult to call?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group,
What I do, is to define methods in the app_controller, just like:
function userId() {
return $this-Session-read('Auth.User.id');
}
If you want to access the current userId in another controller then
simply call
$userid = $this-userId();
HTH
Cheers,
tobi_one
On Jul 28, 6:09 pm, Dave
Thanks,
Sounds good.
Will give that a try.
Dave
-Original Message-
From: tobi_one [mailto:tobias.h...@gmail.com]
Sent: July-28-09 2:38 PM
To: CakePHP
Subject: Re: Set user variables
What I do, is to define methods in the app_controller, just like:
function userId() {
return
Why not just use $this-Auth-user('whatever')? AppController loads
the Auth component, so any other controller can access it.
Also, AppController::beforeFilter() will still run if you do not have
beforeFilter() in your own controller. It will only *not* run if you
override beforeFilter() in your