diff options
-rw-r--r-- | engine/lib/users.php | 30 | ||||
-rw-r--r-- | languages/en.php | 5 | ||||
-rw-r--r-- | search/index.php | 5 | ||||
-rw-r--r-- | views/default/search/startblurb.php | 8 | ||||
-rw-r--r-- | views/default/user/search/finishblurb.php | 17 | ||||
-rw-r--r-- | views/default/user/search/startblurb.php | 8 |
6 files changed, 71 insertions, 2 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;
+
+ }
}
diff --git a/languages/en.php b/languages/en.php index c2337c7fb..c833b327c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -236,6 +236,11 @@ 'viewtype:list' => "List view",
'viewtype:gallery' => "Gallery",
+ 'tag:search:startblurb' => "Items with tags matching '%s':",
+
+ 'user:search:startblurb' => "Users matching '%s':",
+ 'user:search:finishblurb' => "To view more, click here.",
+
/**
* Account
*/
diff --git a/search/index.php b/search/index.php index 0553879b2..4d4d269ca 100644 --- a/search/index.php +++ b/search/index.php @@ -33,7 +33,10 @@ }
if (!empty($tag)) {
- $body = elgg_view_title(sprintf(elgg_echo('searchtitle'),$tag));
+ $body = "";
+ $body .= elgg_view_title(sprintf(elgg_echo('searchtitle'),$tag));
+ $body .= trigger_plugin_hook('search','',$tag,"");
+ $body .= elgg_view('search/startblurb',array('tag' => $tag));
$body .= list_entities_from_metadata($md_type, $tag, $objecttype, $subtype, $owner_guid, 10, false);
$body = elgg_view_layout('one_column',$body);
}
diff --git a/views/default/search/startblurb.php b/views/default/search/startblurb.php new file mode 100644 index 000000000..8aa1ea371 --- /dev/null +++ b/views/default/search/startblurb.php @@ -0,0 +1,8 @@ +
+<p>
+ <?php
+
+ echo sprintf(elgg_echo("tag:search:startblurb"),$vars['tag']);
+
+ ?>
+</p>
\ No newline at end of file diff --git a/views/default/user/search/finishblurb.php b/views/default/user/search/finishblurb.php new file mode 100644 index 000000000..bc7b9d787 --- /dev/null +++ b/views/default/user/search/finishblurb.php @@ -0,0 +1,17 @@ +<?php
+
+ if ($vars['count'] > $vars['threshold']) {
+
+?>
+<p>
+ <?php
+
+ echo elgg_echo("user:search:finishblurb");
+
+ ?>
+</p>
+<?php
+
+ }
+
+?>
\ No newline at end of file diff --git a/views/default/user/search/startblurb.php b/views/default/user/search/startblurb.php new file mode 100644 index 000000000..c987dd8dc --- /dev/null +++ b/views/default/user/search/startblurb.php @@ -0,0 +1,8 @@ +
+<p>
+ <?php
+
+ echo sprintf(elgg_echo("user:search:startblurb"),$vars['tag']);
+
+ ?>
+</p>
\ No newline at end of file |