This is code at view admin
<h2>User: <?php echo $user->id ?></h2>
in view appears 3 as user id
this in model
$criteria=new CDbCriteria;
$doc = $user->id; //desc id
if(Yii::app()->user->id=='1'){
$user = User::model()->findByPk(Yii::app()->user->id);
$userLogin = $user->login;
$criteria->addCondition("user_id= $doc");
}
$doc is undifined,, how get value $user->id from view admin
Implement your user class with IdentityInterface yii\web\IdentityInterface In your configuration file
Then You may use this code to get user id in your view files as