? .DS_Store
? bench.php
? buzz.mysql
? diff.diff
? double_ids_patch
? edit_comment.diff
? files
? filterundef.patch
? info.php
? js-error.patch.txt
? module-file-missing.patch
? node.module_26_0.patch
? opsie.patch
? rss.xml
? search.patch
? search_14.patch
? search_profiles.patch
? stat_0.patch
? submit_goto.patch
? system.module_21.patch
? trouwen
? truncate.patch
? vancode.php
? xmlparse.php
? modules/.DS_Store
? modules/buzz.module
? modules/buzz.module.txt
? modules/itf.module
? modules/module_builder
? modules/test.install
? modules/test.module
? modules/tiered_user_perm_0.patch
? sites/128.189.190.148.drupal
? sites/192.168.0.2.drupal
? sites/localhost.drupal
? sites/localhost.drupal2
? sites/localhost.drupal46u
? themes/.DS_Store
? themes/bluebeach
? themes/schaak
Index: modules/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile.module,v
retrieving revision 1.136
diff -u -r1.136 profile.module
--- modules/profile.module	26 Feb 2006 19:46:13 -0000	1.136
+++ modules/profile.module	28 Feb 2006 14:46:39 -0000
@@ -614,6 +614,46 @@
   }
 }
 
+function profile_search($op = 'search', $keys = null) {
+  switch ($op) {
+    case 'name':
+      if (user_access('access user profiles')) {
+        return t('users');
+      }
+    case 'search':
+      if (user_access('access user profiles')) {
+        $find = array();
+        // Replace wildcards with MySQL/PostgreSQL wildcards.
+        $keys = preg_replace('!\*+!', '%', $keys);
+
+        if (user_access('administer users')) {
+          // administrators don't have restrictions
+          $result = pager_query("SELECT u.uid, u.name FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid WHERE LOWER(pv.value) LIKE LOWER('%%%s%%') OR LOWER(u.name) LIKE LOWER('%%%s%%') GROUP BY u.uid, u.name ORDER BY u.name ASC", 15, 0, NULL, $keys, $keys);
+        }
+        else {
+          // non-administrators can only search public fields and active users
+          $result = pager_query("SELECT u.uid, u.name FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid INNER JOIN {profile_fields} pf ON pv.fid = pf.fid WHERE ((LOWER(pv.value) LIKE LOWER('%%%s%%') AND pf.visibility IN (%d, %d)) OR LOWER(u.name) LIKE LOWER('%%%s%%')) AND u.status = 1 GROUP BY u.uid, u.name ORDER BY u.name ASC", 15, 0, NULL, $keys, PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS, $keys);
+        }
+
+        while ($account = db_fetch_object($result)) {
+          $user = user_load(array('uid' => $account->uid));
+          $profile_fields = profile_view_profile($user);
+
+          $entry = array();
+          foreach ($profile_fields as $category => $fields) {
+            foreach ($fields as $field) {
+              $entry[] = $field['value'];
+            }
+          }
+
+          $view = implode(', ', $entry);
+          $find[] = array('title' => $account->name, 'link' => url("user/$account->uid/view"), 'snippet' => search_excerpt($keys, $view));
+        }
+        return $find;
+      }
+  }
+}
+
 function _profile_field_form($type, $edit = array()) {
 
   $form['fields'] = array('#type' => 'fieldset',
Index: modules/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user.module,v
retrieving revision 1.592
diff -u -r1.592 user.module
--- modules/user.module	27 Feb 2006 22:51:31 -0000	1.592
+++ modules/user.module	28 Feb 2006 14:46:46 -0000
@@ -438,29 +438,6 @@
 }
 
 /**
- * Implementation of hook_search().
- */
-function user_search($op = 'search', $keys = null) {
-  switch ($op) {
-    case 'name':
-      if (user_access('access user profiles')) {
-        return t('users');
-      }
-    case 'search':
-      if (user_access('access user profiles')) {
-        $find = array();
-        // Replace wildcards with MySQL/PostgreSQL wildcards.
-        $keys = preg_replace('!\*+!', '%', $keys);
-        $result = pager_query("SELECT * 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));
-        }
-        return $find;
-      }
-  }
-}
-
-/**
  * Implementation of hook_user().
  */
 function user_user($type, &$edit, &$user, $category = NULL) {
@@ -750,12 +727,6 @@
       'callback' => 'user_admin_access_delete', 'access' => $access_access,
       'type' => MENU_CALLBACK);
 
-    if (module_exist('search')) {
-      $items[] = array('path' => 'admin/user/search', 'title' => t('search'),
-        'callback' => 'user_admin', 'access' => $admin_access,
-        'type' => MENU_LOCAL_TASK);
-    }
-
     //Your personal page
     if ($user->uid) {
       $items[] = array('path' => 'user/'. $user->uid, 'title' => t('my account'),
@@ -1917,10 +1888,6 @@
   }
 
   switch ($op) {
-    case 'search':
-    case t('Search'):
-      $output = search_form(url('admin/user/search'), $_POST['edit']['keys'], 'user') . search_data($_POST['edit']['keys'], 'user');
-      break;
     case t('Create new account'):
     case 'create':
       $output = user_register();
@@ -1969,8 +1936,6 @@
       <li>Anonymous user: this role is used for users that don\'t have a user account or that are not authenticated.</li>
       <li>Authenticated user: this role is automatically granted to all logged in users.</li>
       </ul>', array('%permissions' => url('admin/access/permissions')));
-    case 'admin/user/search':
-      return t('<p>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 'admin/user/configure':
     case 'admin/user/configure/settings':
       return t('<p>In order to use the full power of Drupal a visitor must sign up for an account. This page lets you setup how a user signs up, logs out, the guidelines from the system about user subscriptions, and the e-mails the system will send to the user.</p>');
