tags:

views:

31

answers:

2

It seems like a two-step process to get this,

    $u = $this->Auth->user();
    $uid = $u['User']['id'];

Isn't there a variable set somewhere once a user is logged in? (Sorry for the dumb question.)

+2  A: 

I think you can do $uid = $this->Auth->user('id'); - check the api: http://api.cakephp.org/class/auth-component#method-AuthComponentuser

Leo
The fact that you can supply a key arg is right there in the API... I think I'll take a look in there more often.
Mark Flint
+2  A: 

Try this:

$this->Auth->user('id')
santiagobasulto