aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-04 11:50:06 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-04 11:50:06 +0000
commita64e1b87620bbb1d8e785532786cc63b31047c36 (patch)
tree33a91c28554b214d2f0ac7c870d7793cbc91e340 /engine
parent554de1cb14a863768f96395d4b18bf50d406f39e (diff)
downloadelgg-a64e1b87620bbb1d8e785532786cc63b31047c36.tar.gz
elgg-a64e1b87620bbb1d8e785532786cc63b31047c36.tar.bz2
First pass on user search
git-svn-id: https://code.elgg.org/elgg/trunk@1288 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/users.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 20a974430..cec5c87c7 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -735,7 +735,10 @@
} else {
$query = "SELECT e.* ";
}
- $query .= "from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid where match(u.name,u.username) against ('$criteria') and $access";
+ $query .= "from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid where ";
+ // $query .= " match(u.name,u.username) against ('$criteria') ";
+ $query .= "(u.name like \"%{$criteria}%\" or u.username like \"%{$criteria}%\")";
+ $query .= " and $access";
if (!$count) {
$query .= " order by $order_by limit $offset, $limit"; // Add order and limit
@@ -970,6 +973,31 @@
//register_action("user/language");
register_plugin_hook('usersettings:save','user','users_settings_save');
+ register_plugin_hook('search','all','search_list_users_by_name');
+
+ }
+
+ /**
+ * Returns a formatted list of users suitable for injecting into search.
+ *
+ */
+ function search_list_users_by_name($hook, $user, $returnvalue, $tag) {
+
+ // Change this to set the number of users that display on the search page
+ $threshold = 4;
+
+ if ($users = search_for_user($tag,$threshold)) {
+
+ $countusers = search_for_user($tag,0,0,"",true);
+
+ $return = elgg_view('user/search/startblurb',array('count' => $countusers, 'tag' => $tag));
+ foreach($users as $user) {
+ $return .= elgg_view_entity($user);
+ }
+ $return .= elgg_view('user/search/finishblurb',array('count' => $countusers, 'threshold' => $threshold, 'tag' => $tag));
+ return $return;
+
+ }
}