diff -Nup profileplus-ori\profileplus.info profileplus\profileplus.info
--- profileplus-ori\profileplus.info	Wed Dec 31 19:00:00 1969
+++ profileplus\profileplus.info	Sat Jun 23 20:46:10 2007
@@ -0,0 +1,9 @@
+; $Id: profileplus.info,v 2.0 2007/06/23 20:37:50 incrn8 Exp$ $
+name = ProfilePlus
+description = "Search custom user profile fields."
+package = Other
+version = "$Name$"
+
+; Information added by drupal.org packaging script on 2007-06-23
+version = "5.x-1.x-dev"
+project = "profileplus"
\ No newline at end of file
diff -Nup profileplus-ori\profileplus.install profileplus\profileplus.install
--- profileplus-ori\profileplus.install	Wed Dec 31 19:00:00 1969
+++ profileplus\profileplus.install	Sat Jun 23 20:46:20 2007
@@ -0,0 +1,24 @@
+<?php
+// $Id: profileplus.install,v 2.0 2007/06/23 20:37:50 incrn8 Exp$
+
+
+/**
+ * Implementation of hook_install().
+ */
+function profileplus_install() {
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      // put profileplus after user.module by increasing its weight
+      db_query("UPDATE {system} SET weight = 2 WHERE name = 'profileplus'");
+      break;
+    case 'pgsql':
+      db_query("UPDATE {system} SET weight = 2 WHERE name = 'profileplus'");
+      break;
+  }
+  if (module_exists('profile') == FALSE) {
+    module_enable(array('profile'));
+    drupal_set_message('Profile module has been activated.');
+  }
+  drupal_set_message('ProfilePlus module is now installed. To remove the Users tab from the Search page, remember to add the code in the README.txt file to template.php.');
+}
diff -Nup profileplus-ori\profileplus.module profileplus\profileplus.module
--- profileplus-ori\profileplus.module	Tue Apr 25 12:56:42 2006
+++ profileplus\profileplus.module	Mon Jul 02 17:55:06 2007
@@ -1,11 +1,16 @@
 <?php
-// profileplus.module,v 1.2 2006/04/23 01:07:50 budda Exp
-/*
- * ProfilePlus adds additional functionality to the core profile.module
+// $Id: profileplus.module,v 2.0 2007/06/23 20:37:50 incrn8 Exp$
+
+
+/**
+ * @file
+ * Allows full searching of all user profile fields
  *
  * @author Mike Carter <mike@ixis.co.uk>
+ *
  */
 
+
 /**
  * Implementation of hook_help().
  */
@@ -16,15 +21,12 @@ function profileplus_help($section) {
    }
 }
 
+
 /**
- * Hide the default 'users' tab from the search page as it is useless
+ * Implementation of hook_perm().
  */
-function profileplus_menu() {
-  $items = array();
-
-  $items[] = array('path' => 'search/user', 'type' => MENU_CALLBACK);
-
-  return $items;
+function profileplus_perm() {
+  return array('search user profiles');
 }
 
 
@@ -35,47 +37,67 @@ function profile_search($op = 'search', 
   switch ($op) {
     case 'name':
       if (user_access('access user profiles')) {
-        return t('profiles');
+        return t('User Profiles');
       }
     case 'search':
       if (user_access('access user profiles')) {
         $find = array();
-        // Replace wildcards with MySQL/PostgreSQL wildcards.
+        $keywords = explode(' ', check_plain(strip_tags($keys)));
+        $i = count($keywords);
         $keys = preg_replace('!\*+!', '%', $keys);
-        if (user_access('administer users')) {
-          // administrators don't have restrictions
-          $sql = "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%%')";
-          $result = pager_query('SELECT DISTINCT u.* '.$sql, 15, 0, 'SELECT COUNT(DISTINCT u.uid) '.$sql, $keys);
-        }
-        else {
-          // non-administrators can only search public fields and active users
-          $sql = "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) AND u.status = 1";
-          $result = pager_query('SELECT DISTINCT u.* '.$sql, 15, 0, 'SELECT COUNT(DISTINCT u.uid) '.$sql, $keys, PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
-        }
 
-        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'];
+        if ($i > 0){
+          $users = array();
+          $match = array();
+          while ($i > 0) {
+            $j = $i - 1;
+            if (user_access('administer users')) {
+            // administrators don't have restrictions
+              $sql = "FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid INNER JOIN {profile_fields} pf ON pv.fid = pf.fid WHERE pv.value LIKE '%%%s%%' OR u.name LIKE '%%%s%%'";
+              $result = db_query('SELECT DISTINCT u.* '.$sql, $keywords[$j], $keywords[$j]);
             }
+            elseif (user_access('search user profiles')) {
+            // non-administrators can only search public fields and active users
+              $sql = "FROM {users} u INNER JOIN {profile_values} pv ON u.uid = pv.uid INNER JOIN {profile_fields} pf ON pv.fid = pf.fid WHERE pv.value LIKE '%%%s%%' OR u.name LIKE '%%%s%%' AND pf.visibility IN (%d, %d) AND u.status = 1";
+              $result = db_query('SELECT DISTINCT u.* '.$sql, $keywords[$j], $keywords[$j], PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
+            }
+
+            while ($auser = db_fetch_object($result)) {
+              if (in_array($auser->uid,$users) && !in_array($auser->uid,$match)){
+                $match[] = $auser->uid;
+              }
+              else {
+                $users[] = $auser->uid;
+              }
+            }
+            $i = $i - 1;
           }
 
-          $view = implode(' | ', $entry);
-          $find[] = array('title' => $account->name, 'link' => url("user/$account->uid/view"), 'snippet' => search_excerpt($keys, $view));
-        }
+          if ($match) {
+            $items = $match;
+          }
+          else {
+            $items = $users;
+          }
 
-        return $find;
-      }
+          if ($items) {
+            $finalsql = pager_query('SELECT * FROM {users} WHERE uid IN ('.implode(', ', $items).')');
+              while ($pageditems = db_fetch_object($finalsql)) {
+                $user = user_load(array('uid'=>$pageditems->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' => $user->name, 'link' => url("user/$user->uid"), 'snippet' => search_excerpt($keys, $view));
+                }
+              }
+          }
+          return $find;
+        }
+      } // end search case
   }
 }
-
-function profileplus_install() {
-  // new module weights in core: put profileplus after user.module
-  $ret[] = db_query("UPDATE {system} SET weight = 2 WHERE name = 'profileplus'");
-  return $ret;
-}
-?>
\ No newline at end of file
diff -Nup profileplus-ori\README.txt profileplus\README.txt
--- profileplus-ori\README.txt	Wed Dec 31 19:00:00 1969
+++ profileplus\README.txt	Sat Jun 23 20:44:12 2007
@@ -0,0 +1,53 @@
+README.txt file for ProfilePlus module.
+
+This module allows you to search all public fields in a user's profile. This includes the default
+fields created by Drupal e.g. username, and any custom fields you might create with the Profile module.
+Multiple keyowrd searching is possible with this module. The returned results will link directly to
+the user's profile.
+
+There are two steps to the installation of this module.
+
+1. Copy all files into their own folder, in the modules folder (preferably in sites/all/modules/profileplus).
+2. In your theme's folder edit (or create) template.php and add the following code to it (you can
+   omit this step if you want to keep the Users tab present on the search page):
+
+//-- start
+
+/**
+ * Override or insert PHPTemplate variables into the templates.
+ */
+function _phptemplate_variables($hook, $vars) {
+  if ($hook == 'page') {
+    themename_removetab('Users', $vars);              // replace themename with your theme's name
+    return $vars;
+  }
+  return array();
+}
+
+
+/**
+ * Removes a tab
+ */
+function themename_removetab($label, &$vars) {       // replace themename with your theme's name
+  $tabs = explode("\n", $vars['tabs']);
+  $vars['tabs'] = '';
+
+  foreach($tabs as $tab) {
+    if(strpos($tab, '>' . $label . '<') === FALSE) {
+      $vars['tabs'] .= $tab . "\n";
+    }
+  }
+}
+
+//-- end
+
+NOTE: If your template.php already contains a function _phptemplate_variables, then only add the following
+code into that function, before the return $vars; line (you must still add the themename_removetab function):
+
+  if ($hook == 'page') {
+    themename_removetab('Users', $vars);              // replace themename with your theme's name
+  }
+
+Once those steps are completed, you will have a User Profiles tab on your search page. The default
+Users tab will have been removed to avoid confusion and redundancy, seeing as this module searches
+the same data that the user.module's search does.
\ No newline at end of file
