Assuming I have 2 roles set up:

rid 1 = 'Customer'
rid 2 = 'Management'

$newUser = array(
	      'name' => $name,
	      'pass' => $password,
	      'mail' => $mail,
	      'status' => 1,
	      'roles' => array(1 => 'Management'),
	      'notify' => 1
$user = user_save(null, $newUser);

The above code would still validate and assign the customer permission to the user although the role title does not match the role id.


Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.