Commit 434b91fb authored by Nigel McNie's avatar Nigel McNie
Browse files

Use role rather than tutor column when working out name to display in display_name.

parent 5eb99862
......@@ -399,13 +399,13 @@ function display_name($user, $userto=null, $nameonly=false) {
return $user->preferredname . ' (' . $user->firstname . ' ' . $user->lastname . ' - ' . $user->username . ')';
}
$sql = 'SELECT g1.member
$sql = "SELECT g1.member
FROM {group_member} g1
JOIN {group_member} g2
ON g1.group = g2.group
JOIN {group} g ON (g.id = g1.group AND g.deleted = 0)
WHERE g1.member = ? AND g2.member = ? AND g2.tutor = ?';
if (record_exists_sql($sql, array($user->id, $userto->id, 1))) {
WHERE g1.member = ? AND g2.member = ? AND g2.role = 'tutor'";
if (record_exists_sql($sql, array($user->id, $userto->id))) {
return $user->preferredname . ($nameonly ? '' : ' (' . $user->firstname . ' ' . $user->lastname . ')');
}
return $user->preferredname;
......
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