03-14-2016, 01:10 PM
This code will dump out the names of the groups the logged in user belongs to. Give it a try and come back with any questions.
<pre></pre>
<pre>
Code:
$db = DB::getInstance();
$query = $db->query("SELECT * FROM user_permission_matches WHERE user_id = ?", array($user->data()->id));
$x = $query->results(true);
//dump($x);
foreach ($x as $y){
//dump($y);
$perm_id=$y["permission_id"];
$query = $db->query("SELECT * FROM permissions WHERE id = ?", array($perm_id));
$z = $query->results(true);
//dump($z[0]);
$perm_name=$z[0]["name"];
echo $perm_name.'<br/>';;
}