I am trying to redirect to different locations depending on which
group a user belongs to after logging in. The problem I am having is
that it keeps going to the redirect for group 1 even when it should be
going to the redirect for group 2:

function login()
 {
$this->layout = 'login';
if ($this->Auth->user())
  {
$groupmember = $this->Session->read('Auth.User.group_id');
if($groupmember==1)
$this->Auth->loginRedirect = array('controller' => 'users', 'action'
=> 'index');
else
$this->Auth->loginRedirect = array('controller' => 'tenants', 'action'
=> 'tenantview');
 }

 }

I have confirmed that the group_id is being picked up by the session
variable by displaying it on the redirected view so I know at least
the variable is not empty.

Anyone have a clue what I am doing wrong here?

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 [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