Commit 23210afc authored by Robert Lyon's avatar Robert Lyon

Bug 1529753: Passing through the preferred name value

When displaying names for adding group members to groups

behatnotneeded

Change-Id: I0fb09eb1a17bd94c58533b8272db38e439897cbe
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 564caacd)
parent d22c3042
...@@ -59,7 +59,7 @@ $results = get_group_user_search_results( ...@@ -59,7 +59,7 @@ $results = get_group_user_search_results(
); );
if (!param_integer('html', 1)) { if (!param_integer('html', 1)) {
foreach ($results['data'] as &$result) { foreach ($results['data'] as &$result) {
$result = array('id' => $result['id'], 'name' => $result['name']); $result = array('id' => $result['id'], 'name' => display_name($result['id'], $USER->get('id')));
} }
json_reply(false, $results); json_reply(false, $results);
} }
......
...@@ -552,7 +552,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -552,7 +552,7 @@ class PluginSearchInternal extends PluginSearch {
if ($membershiptype == 'nonmember') { if ($membershiptype == 'nonmember') {
$select = ' $select = '
u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon, u.staff, u.urlid'; u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon, u.staff, u.urlid, u.preferredname';
$from = ' $from = '
FROM {usr} u FROM {usr} u
LEFT OUTER JOIN {usr_account_preference} h ON (u.id = h.usr AND h.field = \'hiderealname\') LEFT OUTER JOIN {usr_account_preference} h ON (u.id = h.usr AND h.field = \'hiderealname\')
...@@ -563,7 +563,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -563,7 +563,7 @@ class PluginSearchInternal extends PluginSearch {
} }
else if ($membershiptype == 'notinvited') { else if ($membershiptype == 'notinvited') {
$select = ' $select = '
u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon, u.staff, u.urlid'; u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon, u.staff, u.urlid, u.preferredname';
$from = ' $from = '
FROM {usr} u FROM {usr} u
LEFT OUTER JOIN {usr_account_preference} h ON (u.id = h.usr AND h.field = \'hiderealname\') LEFT OUTER JOIN {usr_account_preference} h ON (u.id = h.usr AND h.field = \'hiderealname\')
...@@ -577,7 +577,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -577,7 +577,7 @@ class PluginSearchInternal extends PluginSearch {
else if ($membershiptype == 'request') { else if ($membershiptype == 'request') {
$select = ' $select = '
u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon, u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon,
u.staff, u.urlid, ' . db_format_tsfield('gm.ctime', 'jointime'); u.staff, u.urlid, u.preferredname, ' . db_format_tsfield('gm.ctime', 'jointime');
$from = ' $from = '
FROM {usr} u FROM {usr} u
INNER JOIN {group_member_request} gm ON (gm.member = u.id) INNER JOIN {group_member_request} gm ON (gm.member = u.id)
...@@ -593,7 +593,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -593,7 +593,7 @@ class PluginSearchInternal extends PluginSearch {
else if ($membershiptype == 'invite') { else if ($membershiptype == 'invite') {
$select = ' $select = '
u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon, u.id, u.firstname, u.lastname, u.username, u.email, u.profileicon,
u.staff, u.urlid, ' . db_format_tsfield('gm.ctime', 'jointime'); u.staff, u.urlid, u.preferredname, ' . db_format_tsfield('gm.ctime', 'jointime');
$from = ' $from = '
FROM {usr} u FROM {usr} u
INNER JOIN {group_member_invite} gm ON (gm.member = u.id) INNER JOIN {group_member_invite} gm ON (gm.member = u.id)
...@@ -606,7 +606,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -606,7 +606,7 @@ class PluginSearchInternal extends PluginSearch {
else { // All group members else { // All group members
$select = ' $select = '
u.id, u.firstname, u.lastname, u.username, u.preferredname, u.email, u.profileicon, u.id, u.firstname, u.lastname, u.username, u.preferredname, u.email, u.profileicon,
u.staff, u.urlid, ' . db_format_tsfield('gm.ctime', 'jointime') . ', gm.role'; u.staff, u.urlid, u.preferredname, ' . db_format_tsfield('gm.ctime', 'jointime') . ', gm.role';
$from = ' $from = '
FROM {usr} u FROM {usr} u
INNER JOIN {group_member} gm ON (gm.member = u.id) INNER JOIN {group_member} gm ON (gm.member = 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