On Feb 4, 2008 5:13 PM, Tim W <[EMAIL PROTECTED]> wrote:

>
> Hi all,
>
> Thanks mostly to the tutorial linked below I have basic auth working
> in my project. I can create a user in the database (that took a while
> to figure out), have users view public content without logging in, and
> make users log in before they go to a page that's for registered only.
> So far I haven't figured out quite how it works, but it seems to. What
> i'm trying to do is show the "edit" link on a webpage only to
> administrators.
>
> I have a few questions, the first being by far the most important:
> 1) How do I get the username and group (or just the user object) of
> the user currently logged in? I've looked at everything in my debugger
> and can't spot the information anywhere.

- If you are using CakePHP-1.2's built-in Auth component then, in controller
then use $this->Auth->user() to get all user data or
$this->Auth->user('field_name') to get that field's value and if you are in
view then use $session->read('Auth.UserModelName') to get all user data
(change the UserModelName to your need) or $session->read('
Auth.UserModelName.field_name') to get particular field's value

-- 
Regards,
Amit

http://amitrb.wordpress.com/
http://coppermine-gallery.net/
http://cheesecake-photoblog.org/
http://www.sanisoft.com/blog/author/amitbadkas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to