Index: user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.785
diff -u -r1.785 user.module
--- user.module	22 May 2007 05:52:17 -0000	1.785
+++ user.module	25 May 2007 06:13:53 -0000
@@ -481,12 +481,23 @@
       }
     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);
+        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)) {
-          $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
+          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;
       }
@@ -2755,7 +2766,12 @@
       <li>Authenticated user: this role is automatically granted to all logged in users.</li>
       </ul>', array('@permissions' => url('admin/user/access')));
     case 'admin/user/search':
-      return '<p>'. 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".') .'</p>';
+      if (user_access('administer users')) {
+        return '<p>'. 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 "webmaster@brenda.com".') .'</p>';
+      }
+      else {
+        return '<p>'. 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".') .'</p>';
+      }
     case 'user/help#user':
       $site = variable_get('site_name', 'Drupal');
 
