• Role IDs no longer exist, they are replaced by new role (machine) names.
  • The rid column in the users_roles table is now a varchar role column.
  • Old role "names" are now "labels".
  • user_role_load() now takes the role name as its argument instead of role ID.
  • user_role_load_by_name() has been removed, since all roles are loaded by names now.
  • user_roles() now returns an array of machine_name => label values, instead of role_id => role_names.
  • user_roles() now has a 3rd argument $full_objects for loading complete user role objects instead of returning just labels.
  • The structure of a role object is changed to accommodate the new machine names and labels.


$user_role->rid = 5;
$user_role->name = 'my role name';


$user_role->name = 'my_role_name';
$user_role->label = 'My role label';
  • The list of roles in $user->roles is now an unindexed array of user role names, rather than IDs and names.


$user->roles = array(
  2 => 'authenticated user',
  3 => 'administrator',

$user->roles = array('authenticated', 'administrator');

This means when checking user roles, it is now done by checking the value of the roles array, rather than the keys:

$has_role = isset($user->roles[BACKDROP_AUTHENTICATED_RID]);

$has_role = in_array(BACKDROP_AUTHENTICATED_ROLE, $user->roles);

BACKDROP_ANONYMOUS_RID is now renamed to BACKDROP_ANONYMOUS_ROLE and is the value 'anonymous' instead of the integer 1.
BACKDROP_AUTHENTICATED_RID is now renamed to BACKDROP_AUTHENTICATED_ROLE and is the value 'authenticated' instead of the integer 2.

Introduced in branch: 
Introduced in version: 
Module developers
Related Github Issues: