$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 · By Tahir Yasin
Related posts
Yii
Disabled Yii logs and stack trace messages
Open up the index.php from root folder and comment out following 2 lines [code language=”php”] defined(‘YII_DEBUG’) or define(‘YII
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
Yii
Yii Multiple Related Models Save Guide
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