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




<?php

class UserIdentity extends CUserIdentity

{


	public function authenticate()

	{

		$users=array();

			

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

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

		->from('pobbusers')

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

		->queryAll();

    

		foreach ($user as $us) {

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

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

		}   

		

		$dmm=explode("|",$users[$this->username]);

		$ppass=$dmm[0];

		$level=$dmm[1];

		

		if(!isset($users[$this->username]))

			$this->errorCode=self::ERROR_USERNAME_INVALID;

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

			$this->errorCode=self::ERROR_PASSWORD_INVALID;

		else

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

			$this->errorCode=self::ERROR_NONE;

		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')