thyseus / yii-user-management

a user management module collection for the yii framework
185 stars 122 forks source link

Update user/controllers/YumUserController.php #33

Closed garekus closed 12 years ago

garekus commented 12 years ago

$user = YumUser::model()->findByPk($id) - return null, because Yii::app()->user->id; return username not the PK

thyseus commented 12 years ago

how about:

if(is_numeric($id))
$user = YumUser::model()->findByPk($id);
else
$user = YumUser::model()->findByAttributes(array('username' => $id));
garekus commented 12 years ago

Of course, it's more carefully.