With this little code, you can assign many roles to a specified user :
1
2
3
4
5
6
7
8
9
10
|
// Here's an example of how to assign two roles to a user
$usr = user_load($uid); // $uid is the user ID
$roles = array(
'uid' => $uid,
'roles' => array(
10 => 'Supervisor', // 10 is the role ID
17 => 'Author'
)
);
user_save($usr, $roles);
|