function drush_user_create

8.0.x user.drush.inc drush_user_create($name)
6.x user.drush.inc drush_user_create($name)
7.x user.drush.inc drush_user_create($name)
4.x user.drush.inc drush_user_create($name)
5.x user.drush.inc drush_user_create($name)
master user.drush.inc drush_user_create($name)

Creates a new user account.

File

commands/user/user.drush.inc, line 302
Drush User Management commands

Code

function drush_user_create($name) {
  $userversion = drush_user_get_class();
  $mail = drush_get_option('mail');
  $pass = drush_get_option('password');
  $new_user = array(
    'name' => $name,
    'pass' => $pass,
    'mail' => $mail,
    'access' => '0',
    'status' => 1,
  );
  if (!drush_get_context('DRUSH_SIMULATE')) {
    if ($account = $userversion->create($new_user)) {
      return array($account->id() => $account->info());
    }
    else {
      return drush_set_error("Could not create a new user account with the name " . $name . ".");
    }
  }
}