Re: Joining Data for Auth Component to read

2010-04-21 Thread capo64
Well basically I have over a thousand products and I'll be assigning a
price modifier per group (ie Bronze Silver and Gold members have
different prices for their items), so I would think the best way would
be to check the User's Group's price_modifier when the user logs in,
and store it in the session. Then on each of the product pages
multiply the product price by the modifier.

I just can't seem to figure out how to implement the code. I tried in
the user controller:

function login() {
if ($this-Auth-user('id'))
$session-write('Auth.User.Group', 
$this-User-Group-
findById($this-Auth-user('group_id')));
}

But I don't think I fully understand how the login function works.
Please let me know if this is wrong in many ways. I'm brand new to
CakePHP :\

I have an association that User belongsTo Group. There's no way to get
Auth to use this association?
On Apr 21, 1:19 am, thatsgreat2345 thatsgreat2...@gmail.com wrote:
 Auth component only stores values that are in the users table, so you
 can grab the user id using $this-Auth-user('id') and then do a find.
 Or alternatively you can use $this-Auth-login and once if it
 successfully logs in then do a find on the group data and store it in
 the session for later use especially if you are going to be accessing
 it a lot. But if you only need it in one place I'd just recommend
 doing the find when it is needed.

 On Apr 20, 5:52 pm, capo64 globerm1...@gmail.com wrote:

  Hi I have a setup with Users and Groups.

  I've been reading user data using this in my views:
  $session-read('Auth.User.full_name'); ..etc

  Now I need to access information about the group of the user. How can
  I go about doing this?

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Joining Data for Auth Component to read

2010-04-20 Thread capo64
Hi I have a setup with Users and Groups.

I've been reading user data using this in my views:
$session-read('Auth.User.full_name'); ..etc

Now I need to access information about the group of the user. How can
I go about doing this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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