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 Maharaj :: WidePixels.com"
<[email protected]> wrote:
> I have a set of variables that are used throughout the app such as
>
> $auth = $this->Auth->user('id');
> $slug = $this->Auth->user('slug');
> $role = $this->Auth->user('role');
>
> and so on....
>
> How can I define these in the app_controller beforeFilter so I can grab them
> from any controller using
>
> function beforeFilter()
> {
> parent::beforeFilter();
> }
>
> or any other way that will work.
>
> thanks,
>
> Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---