tags:

views:

109

answers:

2

Hello,

My problem is that a variabile is not past from the controller to the view when the user is not logged in, but it is viewable when the user is logged in. My controller method looks like this:

function publicprofile( $username ) {
        $user = $this->Users->find('first', array('conditions' => array('username' => $username)));
        $this->set('user', $user['Users']);
    }

The method is in the allowed list and everything works, just that $user is not set.

Thanks

+3  A: 

AuthComponent must be overwriting your $user variable in the view. Rename it in your controller like so:

$this->set('myUser', $user['Users']);
Andrew Kolesnikov
This was the problem, thank you very much
kio
+1  A: 
$this->set('user', $user['Users']);

should be singular

$this->set('user', $user['User']);
matyas
My model name is named Users, so $user['Users'] is correct
kio