? 751986_drush_commandfile_list_docs.patch
? 942642_1_drush_uli.patch
? includes/table.inc
Index: commands/user/user.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/user/user.drush.inc,v
retrieving revision 1.4
diff -u -p -r1.4 user.drush.inc
--- commands/user/user.drush.inc	13 Oct 2010 07:48:59 -0000	1.4
+++ commands/user/user.drush.inc	15 Oct 2010 15:35:25 -0000
@@ -26,6 +26,8 @@ function user_drush_help($section) {
       return dt("Cancel a user account.");
     case 'drush:user-password':
       return dt("(Re)Set the password for the given user account.");
+    case 'drush:user-login':
+      return dt("Display a one time login link for the given user account (defaults to uid 1).");
   }
 }
 
@@ -162,6 +164,18 @@ function user_drush_command() {
         '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.',
+    ),
+  );
 
   // Drupal 7 only options.
   if (drush_drupal_major_version() >= 7) {
@@ -461,6 +475,29 @@ function drush_user_password($name) {
 }
 
 /**
+ * Displays a one time login link for the given user.
+ */
+function drush_user_login($name = NULL) {
+  if (empty($name)) {
+    $user = user_load(1);
+    $name = '[uid 1]';
+  }
+  elseif (drush_drupal_major_version() >= 7) {
+    $user = user_load_by_name($name);
+  }
+  else {
+    $user = user_load(array('name' => $name));
+  }
+
+  if ($user !== FALSE) {
+    drush_print(user_pass_reset_url($user));
+  }
+  else {
+    drush_set_error("The user account with the name " . $name . " could not be loaded!");
+  }
+}
+
+/**
  * Print information about a given uid
  */
 function _drush_user_print_info($uid) {
