The next php function ..... in fact, I just made it a function, because it is more accurate, and I needed to use it in several views, but you could use this code directly in your view. Ideally, this should probably be in the module.
function get_role_weight($userId){
$users = user_load($userId);
$userRole = $users->roles;
$arr = Array();
foreach($userRole as $row){
$roleID = user_role_load_by_name($row)->rid;
$role = user_role_load($roleID);
$arr[] = $role->weight;
}
sort($arr);
return $arr[0];
}
How it's done
- "Global: PHP"
- - ,
" :": return get_role_weight($data->uid);
" :" <?php print $value; ?>
, , , "Global: PHP" " ", " :": if ($row1->php < $row2->php) { return -1;} else { return 1;}