Logged Username

Can anyone help me to find logged in username in yii application?

Take a look at the guide topic related to the user authentication (http://www.yiiframework.com/doc/guide/1.1/en/topics.auth). In a nutshell there are two approaches:

  1. You have the ID of the currently authenticated user (Yii::app()->user->id), so the only thing you should do is to retrieve user name by known ID from the database (e.g. User::model()->findByPk(Yii::app()->user->id))).

  2. Use the CBaseUserIdentity::setState() method to save the data unique for the current user.

in fact there is also


which should contain user name, but what it really contain depends on what was passed in during authentication.