Add multiple user-roles in install profile I would like to create multiple roles with the same permissions in my install profile. To add one user in your install profile, it's quite simple. I use this snippet: 

    // Make the new role
    $role = new stdClass;
    $role-&gt;name = 'User 1';
    $role-&gt;weight = 3;
    user_role_save($role);

    // Permissions to assign to the role.
    $perms = array(
    'access content',
    'access content overview',
    );

    // Grant the permissions. This function takes care of all necessary cache resets
    user_role_grant_permissions($role-&gt;rid, $perms);


I tried with an array, but it didn't work out. Drupal just ignored the array. 

The Array didn't work out...:  

    // Make the new role
    $role = new stdClass;
    $roles = array('Eindredacteur 1', 'Eindredacteur 2');
    $role-&gt;name = $roles;
    $role-&gt;weight = 3;
    user_role_save($role);

    // Permissions to assign to the role.
    $perms = array(
    'access content',
    );

    // Grant the permissions. This function takes care of all necessary cache resets
    user_role_grant_permissions($role-&gt;rid, $perms);


Anyone who can give me some advice?
This should work:

// Make the first role
$role = new stdClass;
$role-&gt;name = 'Eindredacteur 1';
$role-&gt;weight = 3;
user_role_save($role);
$roleid_1 = $role-&gt;rid;

// Make the second role
$role = new stdClass;
$role-&gt;name = 'Eindredacteur 2';
$role-&gt;weight = 3;
user_role_save($role);
$roleid_2 = $role-&gt;rid;

// Permissions to assign to the role.
$perms = array(
'access content',
);

// Grant the permissions. This function takes care of all necessary cache resets
user_role_grant_permissions($roleid_1, $perms);    
user_role_grant_permissions($roleid_2, $perms);