Re: Finding Auth'd users Username
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" 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: > '.$username.' in group '.$usergroup; ?> > > 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" 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 > > > 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 -~--~~~~--~~--~--~---
Re: Finding Auth'd users Username
Hmm, Thanks. I'll have to toy with that. Looks like a good way to do it. ^_^ On Dec 12, 3:58 am, "Liebermann, Anja Carolin" 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: > '.$username.' in group '.$usergroup; ?> > > 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" 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 > > > 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 -~--~~~~--~~--~--~---
AW: Finding Auth'd users Username
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: 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" 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 > > 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 -~--~~~~--~~--~--~---
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" 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 > > 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 -~--~~~~--~~--~--~---
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" 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 > > 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 -~--~~~~--~~--~--~---
Re: Finding Auth'd users Username
In your view you can use something like :- if ($session->check('Auth.User.id')) { echo $session->read('Auth.User.username'); } Brett Wilton http://wiltonsoftware.com On Fri, Dec 12, 2008 at 8:10 AM, 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 -~--~~~~--~~--~--~---
Re: Finding Auth'd users Username
If your logged in its: $this->Auth->user('username'); Or you can assign a user variable to the view: $this->set('user', $this->Auth->user()); echo $user['username']; Hope that helps. On Dec 11, 11:10 am, "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 -~--~~~~--~~--~--~---
Finding Auth'd users Username
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 -~--~~~~--~~--~--~---