Commit f2c95f8a authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Added username field to some queries to correct display_name usage

parent d5987ce2
......@@ -152,6 +152,7 @@ function profileform_submit(Pieform $form, $values) {
try {
email_user(
(object)array(
'username' => $USER->get('username'),
'firstname' => $USER->get('firstname'),
'lastname' => $USER->get('lastname'),
'preferredname' => $USER->get('preferredname'),
......
......@@ -629,7 +629,7 @@ function auth_handle_account_expiries() {
$wwwroot = get_config('wwwroot');
// Expiry warning messages
if ($users = get_records_sql_array('SELECT u.id, u.firstname, u.lastname, u.preferredname, u.email, i.defaultaccountinactivewarn AS timeout
if ($users = get_records_sql_array('SELECT u.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, i.defaultaccountinactivewarn AS timeout
FROM ' . $prefix . 'usr u, ' . $prefix . 'institution i
WHERE u.institution = i.name
AND ? - ' . db_format_tsfield('u.expiry', false) . ' < i.defaultaccountinactivewarn
......@@ -658,7 +658,7 @@ function auth_handle_account_expiries() {
}
// Inactivity (lastlogin is too old)
if ($users = get_records_sql_array('SELECT u.id, u.firstname, u.lastname, u.preferredname, u.email, i.defaultaccountinactivewarn AS timeout
if ($users = get_records_sql_array('SELECT u.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, i.defaultaccountinactivewarn AS timeout
FROM ' . $prefix . 'usr u, ' . $prefix . 'institution i
WHERE u.institution = i.name
AND (? - ' . db_format_tsfield('u.lastlogin', false) . ') > (i.defaultaccountinactiveexpire - i.defaultaccountinactivewarn)
......
......@@ -79,7 +79,7 @@ switch ($type) {
);
$data = get_records_sql_array('
SELECT v.*,u.firstname,u.lastname, u.preferredname,u.id AS usr
SELECT v.*, u.username, u.firstname, u.lastname, u.preferredname, u.id AS usr
FROM ' . $prefix . 'view v
LEFT OUTER JOIN ' . $prefix . 'view_access_community a ON a.view=v.id
INNER JOIN ' . $prefix.'usr u ON v.owner = u.id ' . $where,
......@@ -97,7 +97,7 @@ switch ($type) {
}
break;
case 'members':
$sql = 'SELECT u.*,c.tutor
$sql = 'SELECT u.*, c.tutor
FROM ' . $prefix . 'usr u JOIN ' . $prefix . 'community_member c
ON c.member = u.id
WHERE c.community = ?';
......
......@@ -61,7 +61,7 @@ if ($control) {
// normal processing (getting friends list)
if (empty($pending)) {
$count = count_records_select('usr_friend', 'usr1 = ? OR usr2 = ?', array($userid, $userid));
$sql = 'SELECT u.id,u.firstname,u.lastname,u.preferredname
$sql = 'SELECT u.id,u.username,u.firstname,u.lastname,u.preferredname
FROM ' . $prefix . 'usr u
WHERE u.id IN (
SELECT (CASE WHEN usr1 = ? THEN usr2 ELSE usr1 END) AS userid
......
......@@ -54,7 +54,7 @@ class PluginNotificationEmaildigest extends PluginNotification {
$users = array();
$sitename = get_config('sitename');
$sql = 'SELECT q.id, u.firstname,u.lastname,u.preferredname,u.email,q.*,' . db_format_tsfield('ctime').'
$sql = 'SELECT q.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, q.*,' . db_format_tsfield('ctime').'
FROM ' . get_config('dbprefix') . 'usr u
JOIN ' . get_config('dbprefix') . 'notification_emaildigest_queue q
ON q.usr = u.id
......
......@@ -73,7 +73,7 @@ function title(r, communities) {
var assess = assessselect(r.id,communities);
}
var f = FORM({'id':('form'+r.id),'method':'post','enctype':'multipart/form-data',
'encoding':'multipart/form-data','onclick':"formsubmit(" + r.id + ");"},
'encoding':'multipart/form-data'},
DIV(null,buttons),
DIV(null,assess));
return [TD(null,A({'href':'view.php?view='+r.id},r.title)),
......
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