Index: user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.802 diff -u -r1.802 user.module --- user.module 22 Jun 2007 08:46:16 -0000 1.802 +++ user.module 22 Jun 2007 21:31:48 -0000 @@ -506,13 +506,24 @@ } case 'search': if (user_access('access user profiles')) { + $admin = user_access('administer users'); $find = array(); // Replace wildcards with MySQL/PostgreSQL wildcards. $keys = preg_replace('!\*+!', '%', $keys); - $result = pager_query("SELECT uid, name FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys); - while ($account = db_fetch_object($result)) { - $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE))); + if ($admin) { + $result = pager_query("SELECT name, uid, mail FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%') OR LOWER(mail) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys); + } + else { + $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys); } + while ($account = db_fetch_object($result)) { + if ($admin) { + $find[] = array('title' => $account->name . ' (' . $account->mail . ')', 'link' => url('user/'. $account->uid, array('absolute' => TRUE))); + } + else { + $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE))); + } + } return $find; } } @@ -2774,9 +2785,14 @@
  • Authenticated user: this role is automatically granted to all logged in users.
  • ', array('@permissions' => url('admin/user/access'))); case 'admin/user/search': - return '

    '. t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda".') .'

    '; - } -} + if (user_access('administer users')) { + return '

    '. t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username or e-mail address. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda@example.com".') .'

    '; + } + else { + return '

    '. t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda".') .'

    '; + } + } +} /** * Retrieve a list of all user setting/information categories and sort them by weight.