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.
Page 1 of 1
user type identification
#2
Posted 08 February 2011 - 08:39 AM
chandru83, on 04 February 2011 - 11:23 AM, said:
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.
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.yiiframew....1/CAuthManager
Share this topic:
Page 1 of 1

Help












