aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/memberlist.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 0b10c123a1..3cc92b5fe0 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -980,27 +980,35 @@ switch ($mode)
);
break;
-
+
case 'livesearch':
- $username_chars = $request->variable('q', '', true);
- $username_chars = utf8_strtolower($username_chars);
-
- $sql = 'SELECT username, user_id
+
+ $username_chars = $request->variable('username', '', true);
+
+ $sql = 'SELECT username, user_id, user_colour
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . '
AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->any_char);
$result = $db->sql_query_limit($sql, 10);
-
- $user_list = array();
+ $user_list = array();
+
while ($row = $db->sql_fetchrow($result))
- {
- $user_list[] = array('id' => $row['user_id'], 'name' => $row['username']);
+ {
+ $user_list[] = array(
+ 'user_id' => (int) $row['user_id'],
+ 'username' => $row['username'],
+ 'result' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
+ );
}
$db->sql_freeresult($result);
$json_response = new \phpbb\json_response();
- $json_response->send($user_list);
+ $json_response->send(array(
+ 'keyword' => $username_chars,
+ 'results' => $user_list,
+ ));
+
break;
-
+
case 'group':
default:
// The basic memberlist
@@ -1638,6 +1646,7 @@ switch ($mode)
'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '',
'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser' || ($mode == '' && $submit)) ? $u_hide_find_member : '',
+ 'U_LIVE_SEARCH' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=livesearch'),
'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),