title: Drupal: assign roles in user_save
body: <p>I can't find a solution or right example for something that should be quite simple: assign a role to an user when creating it, this is what I'm trying:</p>
  
  <pre><code>$edit = array(
          'name' =&gt; $_POST['name'],
          'pass' =&gt; $password,
          'mail' =&gt; $_POST['email'],
          'status' =&gt; 0,
          'language' =&gt; 'es',
          'init' =&gt; $_POST['email'],
          array(2 =&gt;'authenticated', 4=&gt;'my custom role') //as id and named in role db table
        );
  
  user_save(NULL, $edit);
  </code></pre>
  
  <p>The user is not being created, how can I do this?</p>
  
  <p>Thank you</p>