Weird user class issue

Hi all,

I got a weird issue with my user extending class

When i login as admin the var level has been set, but when i login with any other user level isnt set. why is this?

my UserIdentity.php


class UserIdentity extends CUserIdentity


	public function authenticate()




		 $user = Yii::app()->db->createCommand()

		->select('naam, password, level')


		->where('zichtbaar=:id', array(':id'=>'Y'))



		foreach ($user as $us) {

		$add=array($us['naam'] => $us['password']."|".$us['level']);

		$users = array_merge((array)$users, (array)$add); 









		else if($ppass!==$this->password)



			$this->setState('level', $level);


		return !$this->errorCode;





in my main.php

//array(‘label’=>‘User beheer’, ‘url’=>array(’/users’), ‘visible’=>Yii::app()->user->level==‘adm’),

When i login as admin level hold the variable i setted, but on any other user it tells me

Property "CWebUser.level" is not defined.

Im coding php for a while now but im still new with most class things.

Did i do my coding correct?

If you set a session variable using the ‘setState’ function, you should retrieve it using the ‘getState’ function. Try

array('label'=>'User beheer', 'url'=>array('/users'), 'visible'=>Yii::app()->user->getState('level')=='adm')