$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
S
Scriptbaker Editorial Team
The Scriptbaker editorial team comprises engineers, AI specialists, and digital strategists based in Dubai and Rawalpindi. We write about software development, artificial intelligence, and digital transformation to help organisations build better products. Learn more about us →
Related posts
Yii
Separate Front & Admin in Yii
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
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
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