Checks if a user has a role.
int $rid: A role ID.
object|null $account: (optional) A user account. Defaults to the current user.
bool TRUE if the user has the role, or FALSE if not.
function user_has_role($rid, $account = NULL) {
if (!$account) {
$account = $GLOBALS['user'];
}
return isset($account->roles[$rid]);
}