aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-07 20:57:32 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-07 20:57:32 +0000
commit24e3ff747614364d0d44fc1a7644f164146c66e1 (patch)
treecab9495aa3a6daf5c1aa3bac6de61e3436e77380 /engine/lib/users.php
parent413ea817c78a2cd7cbe3bebad1623daaaeea6394 (diff)
downloadelgg-24e3ff747614364d0d44fc1a7644f164146c66e1.tar.gz
elgg-24e3ff747614364d0d44fc1a7644f164146c66e1.tar.bz2
Moved default search hooks into search mod.
Using MySQL's MATCH ... AGAINST instead of likes for most searches. Changed 'tag' to 'q' while maintaining backward compatibility. git-svn-id: http://code.elgg.org/elgg/trunk@3633 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php50
1 files changed, 0 insertions, 50 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index b49fc30fe..f1194b7e4 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1490,7 +1490,6 @@ function users_init() {
register_entity_type('user','');
register_plugin_hook('usersettings:save','user','users_settings_save');
- register_plugin_hook('search', 'user', 'users_search_hook');
// Handle a special case for newly created users when the user is not logged in
// TODO: handle this better!
@@ -1540,55 +1539,6 @@ function users_test($hook, $type, $value, $params) {
return $value;
}
-/**
- * Return default results for searches on users.
- *
- * @param unknown_type $hook
- * @param unknown_type $type
- * @param unknown_type $value
- * @param unknown_type $params
- * @return unknown_type
- */
-function users_search_hook($hook, $type, $value, $params) {
- global $CONFIG;
-
- $query = $params['query'];
-
- $join = "JOIN {$CONFIG->dbprefix}users_entity ue ON e.guid = ue.guid";
- $params['joins'] = array($join);
-
- $where = "(ue.guid = e.guid
- AND (ue.username LIKE '%$query%'
- OR ue.name LIKE '%$query%'
- )
- )";
- $params['wheres'] = array($where);
-
- $entities = elgg_get_entities($params);
- $params['count'] = TRUE;
- $count = elgg_get_entities($params);
-
- // no need to continue if nothing here.
- if (!$count) {
- return array('entities' => array(), 'count' => $count);
- }
-
- // add the volatile data for why these entities have been returned.
- foreach ($entities as $entity) {
- $username = search_get_relevant_substring($entity->username, $query, '<strong class="searchMatch">', '</strong>');
- $entity->setVolatileData('search_matched_title', $username);
-
- $name = search_get_relevant_substring($entity->name, $query, '<strong class="searchMatch">', '</strong>');
- $entity->setVolatileData('search_matched_description', $name);
- }
-
- return array(
- 'entities' => $entities,
- 'count' => $count,
- );
-}
-
-
//register actions *************************************************************
register_elgg_event_handler('init','system','users_init',0);
register_elgg_event_handler('pagesetup','system','users_pagesetup',0);