function user_has_role
Search API
7.x misc.inc | user_has_role($role, $account = NULL) |
6.x misc.inc | user_has_role($role, |
4.x misc.inc | user_has_role($role) |
5.x misc.inc | user_has_role($role, $account = NULL) |
Does the user have the specified role?
File
- includes/
misc.inc, line 1461 - This file contains misc functions for FlightPath
Code
function user_has_role($role) {
global $user;
// Admin always = TRUE
if ($user->id == 1) {
return TRUE;
}
// Check for other users...
if (in_array($role, $user->roles)) {
return TRUE;
}
return FALSE;
}