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->name = 'User 1';
$role->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->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->name = $roles;
$role->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->rid, $perms);
Anyone who can give me some advice?