snippet



How to Find Role of a user in Drupal

Following snippet finds if $user has the role ($role which is a string name of the role) or not: if (is_array($user->roles) && in_array($role, array_values($user->roles))) { return TRUE; }