=== modified file 'modules/user/user.module'
--- modules/user/user.module	
+++ modules/user/user.module	
@@ -1358,13 +1358,7 @@ function user_edit($category = 'account'
 
   if (arg(2) == 'delete') {
     if ($edit['confirm']) {
-      db_query('DELETE FROM {users} WHERE uid = %d', $account->uid);
-      db_query('DELETE FROM {sessions} WHERE uid = %d', $account->uid);
-      db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
-      db_query('DELETE FROM {authmap} WHERE uid = %d', $account->uid);
-      watchdog('user', t('Deleted user: %name %email.', array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', '<'. $account->mail .'>'))), WATCHDOG_NOTICE);
-      drupal_set_message(t('The account has been deleted.'));
-      module_invoke_all('user', 'delete', $edit, $account);
+      user_delete($edit, $account->uid);
       drupal_goto('admin/user');
     }
     else {
@@ -1393,6 +1387,24 @@ function user_edit($category = 'account'
   return drupal_get_form('user_edit', $form);
 }
 
+/**
+ * Delete a user.
+ *
+ * @param $edit An array of submitted form values.
+ * @param $uid The user ID of the user to delete.
+ */
+function user_delete($edit, $uid) {
+  $account = user_load(array('uid' => $uid));
+  db_query('DELETE FROM {users} WHERE uid = %d', $uid);
+  db_query('DELETE FROM {sessions} WHERE uid = %d', $uid);
+  db_query('DELETE FROM {users_roles} WHERE uid = %d', $uid);
+  db_query('DELETE FROM {authmap} WHERE uid = %d', $uid);
+  $array = array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', '<'. $account->mail .'>'));
+  watchdog('user', t('Deleted user: %name %email.', $array), WATCHDOG_NOTICE);
+  drupal_set_message(t('%name has been deleted.', $array));
+  module_invoke_all('user', 'delete', $edit, $account);
+}
+
 function user_edit_validate($form_id, $form_values) {
   user_module_invoke('validate', $form_values, $form_values['_account'], $form_values['_category']);
   // Validate input to ensure that non-privileged users can't alter protected data.
@@ -1441,7 +1453,7 @@ function user_view($uid = 0) {
   // module_invoke_all().
   foreach (module_implements('profile_alter') as $module) {
     $function = $module .'_profile_alter';
-    $function($account, $fields); 
+    $function($account, $fields);
   }
 
   drupal_set_title($account->name);
@@ -1878,31 +1890,249 @@ function theme_user_admin_new_role($form
 }
 
 function user_admin_account() {
+
+  if ($_POST['edit']['accounts'] && $_POST['edit']['operation'] == 'delete') {
+    return user_multiple_delete_confirm();
+  }
+
   $header = array(
-    array('data' => t('Username'), 'field' => 'u.name'),
-    array('data' => t('Status'), 'field' => 'u.status'),
-    array('data' => t('Member for'), 'field' => 'u.created', 'sort' => 'desc'),
-    array('data' => t('Last access'), 'field' => 'u.access'),
-    t('Operations')
+    array('field' => 'u.name'),
+    array('field' => 'u.status'),
+    array('field' => 'u.created', 'sort' => 'desc'),
+    array('field' => 'u.access'),
   );
+
   $sql = 'SELECT u.uid, u.name, u.status, u.created, u.access FROM {users} u WHERE uid != 0';
   $sql .= tablesort_sql($header);
   $result = pager_query($sql, 50);
 
+  $form['options'] = array('#type' => 'fieldset',
+    '#title' => t('Update options'),
+    '#prefix' => '<div class="container-inline">',
+    '#suffix' => '</div>',
+  );
+  $options = array();
+  foreach (module_invoke_all('user_operations') as $key => $value) {
+    $options[$key] = $value[0];
+  }
+  $form['options']['operation'] = array('#type' => 'select',
+                                    '#options' => $options,
+                                    '#default_value' => 'unblock',
+                                  );
+  $form['options']['submit'] = array('#type' => 'submit',
+                                 '#value' => t('Update'),
+                               );
+
+  $destination = drupal_get_destination();
+
   $status = array(t('blocked'), t('active'));
+  $roles = user_roles(1);
+  $view = t('view');
+
   while ($account = db_fetch_object($result)) {
-    $rows[] = array(theme('username', $account),
-                    $status[$account->status],
-                    format_interval(time() - $account->created),
-                    $account->access ? t('%time ago', array('%time' => format_interval(time() - $account->access))) : t('never'),
-                    l(t('edit'), "user/$account->uid/edit", array()));
+    $accounts[$account->uid] = '';
+    $form['name'][$account->uid] = array('#value' => theme('username', $account));
+    $form['status'][$account->uid] =  array('#value' => $status[$account->status]);
+    $users_roles = array();
+    $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = %d', $account->uid);
+    while ($user_role = db_fetch_object($roles_result)) {
+      $users_roles[] = $roles[$user_role->rid];
+    }
+    asort($users_roles);
+    $form['roles'][$account->uid][0] = array('#value' => theme('item_list', $users_roles));
+    $form['member_for'][$account->uid] = array('#value' => format_interval(time() - $account->created));
+    $form['last_access'][$account->uid] =  array('#value' => $account->access ? t('%time ago', array('%time' => format_interval(time() - $account->access))) : t('never'));
+    $form['operations'][$account->uid] = array('#value' => l(t('edit'), "user/$account->uid/edit", array(), $destination));
+  }
+  $form['accounts'] = array('#type' => 'checkboxes',
+                        '#options' => $accounts
+                      );
+  $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
+
+  // Call the form first, to allow for the form_values array to be populated.
+  $output .= drupal_get_form('user_admin_account', $form);
+
+  return $output;
+}
+
+/**
+ * Theme user administration overview.
+ */
+function theme_user_admin_account($form) {
+  // Overview table:
+  $header = array(
+    array(),
+    array('data' => t('Username'), 'field' => 'u.name'),
+    array('data' => t('Status'), 'field' => 'u.status'),
+    t('Roles'),
+    array('data' => t('Member for'), 'field' => 'u.created', 'sort' => 'desc'),
+    array('data' => t('Last access'), 'field' => 'u.access'),
+    t('Operations')
+  );
+
+  $output .= form_render($form['options']);
+  if (isset($form['name']) && is_array($form['name'])) {
+    foreach (element_children($form['name']) as $key) {
+      $row = array();
+      $row[] = form_render($form['accounts'][$key]);
+      $row[] = form_render($form['name'][$key]);
+      $row[] = form_render($form['status'][$key]);
+      $row[] = form_render($form['roles'][$key]);
+      $row[] = form_render($form['member_for'][$key]);
+      $row[] = form_render($form['last_access'][$key]);
+      $row[] = form_render($form['operations'][$key]);
+      $rows[] = $row;
+    }
+
+  }
+  else  {
+    $rows[] = array(array('data' => t('No users available.'), 'colspan' => '7'));
+  }
+
+  $output .= theme('table', $header, $rows);
+  if ($form['pager']['#value']) {
+    $output .= form_render($form['pager']);
   }
 
-  $output = theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 50, 0);
+  $output .= form_render($form);
+
   return $output;
 }
 
+/**
+ * Submit the user administration update form.
+ */
+function user_admin_account_submit($form_id, $edit) {
+  $operations = module_invoke_all('user_operations');
+  $operation = $operations[$edit['operation']];
+  // Filter out unchecked nodes
+  $users = array_diff($edit['accounts'], array(0));
+  if ($function = $operation[1]) {
+    // Add in callback arguments if present.
+    if ($operation[2]) {
+      $args = array_merge(array($users), $operation[2]);
+    }
+    else {
+      $args = array($users);
+    }
+    call_user_func_array($function, $args);
+
+    cache_clear_all();
+    drupal_set_message(t('The update has been performed.'));
+  }
+}
+
+function user_admin_account_validate($form_id, $edit) {
+  $edit['accounts'] = array_diff($edit['accounts'], array(0));
+  if (count($edit['accounts']) == 0) {
+    if ($edit['operation'] == 'delete') {
+      form_set_error('', t('Please select some users to perform the delete operation.'));
+    }
+    else {
+      form_set_error('', t('Please select some users to perform the update on.'));
+    }
+  }
+}
+
+/**
+ * Implementation of hook_user_operations().
+ */
+function user_user_operations() {
+  global $form_values;
+
+  $roles = user_roles(1);
+  unset($roles[2]);  // Can't edit authenticated role.
+
+  $add_roles = array();
+  foreach ($roles as $key => $value) {
+  	$add_roles['add_role-'. $key] = $value;
+  }
+
+  $remove_roles = array();
+  foreach ($roles as $key => $value) {
+  	$remove_roles['remove_role-'. $key] = $value;
+  }
+
+  $operations = array(
+    'unblock' => array(t('Unblock the selected users'), 'user_user_operations_execute', array('unblock')),
+    'block' => array(t('Block the selected users'), 'user_user_operations_execute', array('block')),
+    t('Add a role to the selected users') => array($add_roles),
+    t('Remove a role from the selected users') => array($remove_roles),
+    'delete' => array(t('Delete the selected users'), ''),
+  );
+
+  // If the form has been posted, we need to insert the proper data for role editing if necessary.
+  if ($form_values) {
+    $operation_rid = explode('-', $form_values['operation']);
+    if ($operation_rid[0] == 'add_role' || $operation_rid[0] == 'remove_role') {
+      $operations[$form_values['operation']] =  array(NULL, 'user_multiple_role_edit', array($operation_rid[0], $operation_rid[1]));
+    }
+  }
+
+  return $operations;
+}
+
+/**
+ * Perform the basic node administration operations.
+ */
+function user_user_operations_execute($accounts, $operation) {
+  switch ($operation) {
+    case 'unblock':
+      $query = 'UPDATE {users} SET status = 1 WHERE uid = %d';
+      break;
+    case 'block':
+      $query = 'UPDATE {users} SET status = 0 WHERE uid = %d';
+      break;
+  }
+  foreach ($accounts as $uid) {
+  	db_query($query, $uid);
+  }
+}
+
+function user_multiple_role_edit($accounts, $operation, $rid) {
+  switch ($operation) {
+    case 'add_role':
+      foreach ($accounts as $uid) {
+        if (!db_result(db_query('SELECT uid FROM {users_roles} WHERE uid = %d AND rid = %d', $uid, $rid))) {
+      	  db_query('INSERT INTO {users_roles} VALUES(%d, %d)', $uid, $rid);
+        }
+      }
+      break;
+    case 'remove_role':
+      foreach ($accounts as $uid) {
+        db_query('DELETE FROM {users_roles} WHERE rid = %d AND uid IN(%s)', $rid, implode(',', $accounts));
+      }
+      break;
+  }
+}
+
+function user_multiple_delete_confirm() {
+  $edit = $_POST['edit'];
+
+  $form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
+  // array_filter returns only elements with TRUE values
+  foreach (array_filter($edit['accounts']) as $uid => $value) {
+    $user = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $uid));
+    $form['accounts'][$uid] = array('#type' => 'hidden', '#value' => $uid, '#prefix' => '<li>', '#suffix' => check_plain($user) ."</li>\n");
+  }
+  $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
+
+  return confirm_form('user_multiple_delete_confirm', $form,
+                      t('Are you sure you want to delete these users?'),
+                      'admin/user', t('This action cannot be undone.'),
+                      t('Delete all'), t('Cancel'));
+}
+
+function user_multiple_delete_confirm_submit($form_id, $edit) {
+  if ($edit['confirm']) {
+    foreach ($edit['accounts'] as $uid => $value) {
+      user_delete($edit, $uid);
+    }
+    drupal_set_message(t('The users have been deleted.'));
+  }
+  return 'admin/user';
+}
+
 function user_admin_settings() {
   // User registration settings.
   $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
