$command = Yii::app()->db->createCommand("SELECT * FROM `authassignment` WHERE userid={$user_id}"); $results = $command->queryAll(); $roles = array(); foreach ($results as $result) { $roles[] = $result['itemname']; } $this->setState('roles', $roles);
Yii
Yii Rights: Get all assigned roles of a user
[sourcecode language=”php”] $command = Yii::app()->db->createCommand("SELECT * FROM `authassignment` WHERE userid={$user_id}"); $res
· 5 min read
Related posts
Yii
How to separate front and admin panel in yii-framework
In my previous post I demonstrated you how to render different layout for different user role, now lets move a step forward and see how to create separate front
Yii
How to save multiple related models in Yii [Complete Solution]
Scenario: You are in a situation where you have two related tables a Parent and a child table. You need to create a user experience in which user presses Save b
Yii
How to make Yii checkBoxList selected
Many people find it hard to make the Yii checkBoxList selected on update view, but believe me in fact its very easy and straight forward. This post will help yo