function tinybrowser_sorted_roles in TinyBrowser 7
1 call to tinybrowser_sorted_roles()
File
- ./
tinybrowser.module, line 1017
Code
function tinybrowser_sorted_roles() {
static $sorted;
if (!isset($sorted)) {
$sorted = array();
$member_only = TRUE;
$roles = user_roles($member_only);
$profiles = variable_get('tinybrowser_profiles', array());
$rp = variable_get('tinybrowser_roles_profiles', array());
// $rp[DRUPAL_ANONYMOUS_RID]['weight'] = 12;
$rp[DRUPAL_AUTHENTICATED_RID]['weight'] = 11;
foreach ($roles as $rid => $rname) {
$sorted[$rid] = array(
'name' => $rname,
'weight' => isset($rp[$rid]['weight']) ? $rp[$rid]['weight'] : 0,
'pid' => isset($rp[$rid]['pid']) && isset($profiles[$rp[$rid]['pid']]) ? $rp[$rid]['pid'] : 0,
);
}
uasort($sorted, 'tinybrowser_rolesort');
}
return $sorted;
}