Hello everybody!
I am new to yii and I want to know how I can identify a user is admin or guest. I have a database with a value that is unique for admin users. I will be glad if somebody helps me on this.
Hello everybody!
I am new to yii and I want to know how I can identify a user is admin or guest. I have a database with a value that is unique for admin users. I will be glad if somebody helps me on this.
When you want to see whether a logged in user is a Guest or Authenticated User, please use the code below:
if(Yii::app()->user->isGuest) {
print("Welcome back Guest!");
} else {
print("Welcome back ".Yii::app()->user->name);
}
If Authenticated User and you have various User Types, you need to setup authentication mechanism. For more information, check this out: http://www.yiiframework.com/doc/api/1.1/CAuthManager