Search code examples
phpdrupaldrupal-7drupal-modules

How to get user roles in drupal 7.x?


I want to get the user roles Just like getting node types using this

node_type_get_types();

is there anyway to get user roles using a function like this?


Solution

  • See the user_roles() function which provides a list of all roles, or you can optionally filter on specific conditions (there are more details on the documentation page I linked to).