Commit bcbe5810 authored by Eugene Venter's avatar Eugene Venter
Browse files

Add preferredname to admin user search



Add 'Displayname' column and updated search to include preferredname.

Bug #811799

Change-Id: Ie3d63bf412888b4bf3b0983eaf95396b2f099c00
Signed-off-by: default avatarEugene Venter <eugene@catalyst.net.nz>
parent 77c45fa7
......@@ -190,6 +190,11 @@ function get_admin_user_search_results($search, $offset, $limit) {
'type' => 'contains',
'string' => $word
);
$queries[] = array(
'field' => 'preferredname',
'type' => 'contains',
'string' => $word
);
}
}
foreach ($fullnames as $n) {
......@@ -302,6 +307,10 @@ function build_admin_user_search_results($search, $offset, $limit) {
'name' => get_string('lastname'),
'sort' => true,
),
'preferredname' => array(
'name' => get_string('displayname'),
'sort' => true,
),
'username' => array(
'name' => get_string('username'),
'sort' => true,
......
......@@ -353,7 +353,7 @@ class PluginSearchInternal extends PluginSearch {
$querydata = self::split_query_string(strtolower(trim($query_string)));
$matches = array();
foreach (array('firstname', 'lastname', 'username', 'email') as $f) {
foreach (array('firstname', 'lastname', 'preferredname', 'username', 'email') as $f) {
$matches[] = self::match_user_field_expression($f, 'u');
}
......@@ -365,7 +365,7 @@ class PluginSearchInternal extends PluginSearch {
AND (
' . $termsql . '
)';
$values = array_pad($values, count($values) + 4, $term);
$values = array_pad($values, count($values) + 5, $term);
}
if (!empty($constraints)) {
......@@ -393,7 +393,7 @@ class PluginSearchInternal extends PluginSearch {
if ($count > 0) {
$data = get_records_sql_assoc('
SELECT
u.id, u.firstname, u.lastname, u.username, u.email, u.staff, u.profileicon,
u.id, u.firstname, u.lastname, u.preferredname, u.username, u.email, u.staff, u.profileicon,
u.active, NOT u.suspendedcusr IS NULL as suspended
FROM {usr} u ' . $where . '
ORDER BY ' . $sort . ', u.id',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment