I'm very new to Drupal, so please bear with me if this is a dumb question. According to the globals API, the global $user
object returns roles as an array:
[roles] => Array(
[rid] => name
)
If I reference $user->roles, it gives me the role names.
Short of looping through like this:
foreach($user->roles as $key => $value){
error_log("key: " . $key . " ; value: " . $value);
}
Is there any way to return the role ID (rid) instead of the role name? I need to do conditional processing based on roles, but some of our roles are company-specific, and contain special characters. It would be much easier to work with the ID instead.