Or you can use the trick of simply setting a variable in your app
controller's beforeRender() like:

        if($this->Auth->user()){
            $this->set('auth_user',$this->Auth->user());
        }

Then you have the whole Auth user collection available in your
view ...

On Dec 12, 12:58 am, "Liebermann, Anja Carolin"
<anja.lieberm...@alltours.de> wrote:
> Hi Bios,
>
> What I do is in my app_cotroller.php:
>
>                 $this->set('usergroup',$this->Auth->user('group_id'));
>                 $this->set('user_id',$this->Auth->user('id'));
>                 $this->set('username',$this->Auth->user('name'));
>
> In the element, which I use as part of my navigation I do:
> <span class="menuitem">&nbsp; &nbsp;<? if($usergroup)echo 'Logged in as 
> '.$username.' in group '.$usergroup; ?></span>
>
> HTH
> Anja
>
> -----Ursprüngliche Nachricht-----
> Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
> von bioselem...@gmail.com
> Gesendet: Freitag, 12. Dezember 2008 00:03
> An: CakePHP
> Betreff: Re: Finding Auth'd users Username
>
> Amazing. Thanks for your help, both of you. I think I'm good now. ^_^ *goes 
> off to write a snippit on it*. Thanks alot. :)
>
> On Dec 11, 4:20 pm, "Brett Wilton" <bdwil...@gmail.com> wrote:
>
> > In your view you can use something like :-
>
> > if ($session->check('Auth.User.id')) {
> >   echo $session->read('Auth.User.username');
>
> > }
>
> > ----
> > Brett Wiltonhttp://wiltonsoftware.com
>
> > On Fri, Dec 12, 2008 at 8:10 AM, bioselem...@gmail.com
>
> > <bioselem...@gmail.com> wrote:
>
> > > I've been wacking my head on the wall for the past few days on this.
> > > I've got a basic auth login/logout system set up but for some reason
> > > nothing i try gets me the username. I just want to display it as in
> > > "Your logged in as xyz". I know it's probably something stupid and
> > > I'm no doubt going about it the wrong way. Any help?
>
>
--~--~---------~--~----~------------~-------~--~----~
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, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to