function user_drush_command

8.0.x user.drush.inc user_drush_command()
6.x user.drush.inc user_drush_command()
7.x user.drush.inc user_drush_command()
4.x user.drush.inc user_drush_command()
5.x user.drush.inc user_drush_command()
master user.drush.inc user_drush_command()

Implementation of hook_drush_command().

File

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

Code

function user_drush_command() {
  $items['user-information'] = array(
    'callback' => 'drush_user_information',
    'description' => 'Print information about the specified user(s).',
    'aliases' => array('uinf'),
    'examples' => array(
      'drush user-information 2,3,someguy,somegal,billgates@microsoft.com' => 'Display information about any users with uids, names, or mail addresses matching the strings between commas.',
    ),
    'arguments' => array(
      'users' => 'A comma delimited list of uids, user names, or email addresses.',
    ),
    'options' => array(
      'full' => 'show extended information about the user',
      'short' => 'show basic information about the user (this is the default)',
    ),
  );
  $items['user-block'] = array(
    'callback' => 'drush_user_block',
    'description' => 'Block the specified user(s).',
    'aliases' => array('ublk'),
    'arguments' => array(
      'users' => 'A comma delimited list of uids, user names, or email addresses.',
    ),
    'examples' => array(
      'drush user-block 5,user3 --uid=2,3 --name=someguy,somegal --mail=billgates@microsoft.com' => 'Block the users with name, id, or email 5 or user3, uids 2 and 3, names someguy and somegal, and email address of billgates@microsoft.com',
    ),
    'options' => array(
      'uid' => 'A comma delimited list of uids to block',
      'name' => 'A comma delimited list of user names to block',
      'mail' => 'A comma delimited list of user mail addresses to block',
    ),
  );
  $items['user-unblock'] = array(
    'callback' => 'drush_user_unblock',
    'description' => 'Unblock the specified user(s).',
    'aliases' => array('uublk'),
    'arguments' => array(
      'users' => 'A comma delimited list of uids, user names, or email addresses.',
    ),
    'examples' => array(
      'drush user-unblock 5,user3 --uid=2,3 --name=someguy,somegal --mail=billgates@microsoft.com' => 'Unblock the users with name, id, or email 5 or user3, uids 2 and 3, names someguy and somegal, and email address of billgates@microsoft.com',
    ),
    'options' => array(
      'uid' => 'A comma delimited list of uids to unblock',
      'name' => 'A comma delimited list of user names to unblock',
      'mail' => 'A comma delimited list of user mail addresses to unblock',
    ),
  );
  $items['user-add-role'] = array(
    'callback' => 'drush_user_add_role',
    'description' => 'Add a role to the specified user accounts.',
    'aliases' => array('urol'),
    'arguments' => array(
      'role' => 'The name of the role to add',
      'users' => '(optional) A comma delimited list of uids, user names, or email addresses.',
    ),
    'examples' => array(
      'drush user-add-role "power user" 5,user3 --uid=2,3 --name=someguy,somegal --mail=billgates@microsoft.com' => 'Add the "power user" role to the accounts with name, id, or email 5 or user3, uids 2 and 3, names someguy and somegal, and email address of billgates@microsoft.com',
    ),
    'options' => array(
      'uid' => 'A comma delimited list of uids',
      'name' => 'A comma delimited list of user names',
      'mail' => 'A comma delimited list of user mail addresses',
    ),
  );
  $items['user-remove-role'] = array(
    'callback' => 'drush_user_remove_role',
    'description' => 'Remove a role from the specified user accounts.',
    'aliases' => array('urrol'),
    'arguments' => array(
      'role' => 'The name of the role to remove',
      'users' => '(optional) A comma delimited list of uids, user names, or email addresses.',
    ),
    'examples' => array(
      'drush user-remove-role "power user" 5,user3 --uid=2,3 --name=someguy,somegal --mail=billgates@microsoft.com' => 'Remove the "power user" role from the accounts with name, id, or email 5 or user3, uids 2 and 3, names someguy and somegal, and email address of billgates@microsoft.com',
    ),
    'options' => array(
      'uid' => 'A comma delimited list of uids',
      'name' => 'A comma delimited list of user names',
      'mail' => 'A comma delimited list of user mail addresses',
    ),
  );
  $items['user-create'] = array(
    'callback' => 'drush_user_create',
    'description' => 'Create a user account with the specified name.',
    'aliases' => array('ucrt'),
    'arguments' => array(
      'name' => 'The name of the account to add',
    ),
    'examples' => array(
      'drush user-create newuser --mail="person@example.com" --password="letmein"' => 'Create a new user account with the name newuser, the email address person@example.com, and the password letmein',
    ),
    'options' => array(
      'password' => 'The password for the new account',
      'mail' => 'The email address for the new account',
    ),
  );
  $items['user-cancel'] = array(
    'callback' => 'drush_user_cancel',
    'description' => 'Cancel a user account with the specified name.',
    'aliases' => array('ucan'),
    'arguments' => array(
      'name' => 'The name of the account to cancel',
    ),
    'examples' => array(
      'drush user-cancel username' => 'Cancel the user account with the name username and anonymize all content created by that user.',
    ),
  );
  $items['user-password'] = array(
    'callback' => 'drush_user_password',
    'description' => '(Re)Set the password for the user account with the specified name.',
    'aliases' => array('upwd'),
    'arguments' => array(
      'name' => 'The name of the account to modify',
    ),
    'options' => array(
      'password' => '(required) The new password for the account',
    ),
    'examples' => array(
      'drush user-password someuser --password="gr3@tP@$s"' => 'Set the password for the username someuser to gr3@tP@$s.',
    ),
  );
  $items['user-login'] = array(
    'callback' => 'drush_user_login',
    'description' => 'Display a one time login link for the given user account (defaults to uid 1).',
    'aliases' => array('uli'),
    'arguments' => array(
      'name' => 'The name of the account to log in as. Leave it empty to log in as uid 1.',
    ),
    'examples' => array(
      'drush user-login ryan' => 'Displays a one-time login link for the user ryan.',
      'open `drush user-login ryan`' => 'Open web browser and login as user ryan.',
    ),
  );

  // Drupal 7 only options.
  if (drush_drupal_major_version() >= 7) {
    $items['user-cancel']['options'] = array(
      'delete-content' => 'Delete all content created by the user',
    );
    $items['user-cancel']['examples']['drush user-cancel --delete-content username'] = 'Cancel the user account with the name username and delete all content created by that user.';
  }
  return $items;
}