Commit 6ba570b1 authored by Richard Mansfield's avatar Richard Mansfield

Extract timestamps properly when loading user institutions

parent e2de1055
......@@ -294,7 +294,7 @@ function edituser_institution_submit(Pieform $form, $values) {
$newuser = (object) array(
'usr' => $user->id,
'institution' => $i->institution,
'ctime' => $i->ctime,
'ctime' => db_format_timestamp($i->ctime),
'studentid' => $values[$i->institution . '_studentid'],
'staff' => (int) ($values[$i->institution . '_staff'] == 'on'),
'admin' => (int) ($values[$i->institution . '_admin'] == 'on'),
......
......@@ -795,7 +795,7 @@ function load_user_institutions($userid) {
throw new InvalidArgumentException("couldn't load institutions, no user id specified");
}
if ($institutions = get_records_sql_assoc('
SELECT u.institution,u.ctime,u.expiry,u.studentid,u.staff,u.admin,i.theme
SELECT u.institution,'.db_format_tsfield('ctime').','.db_format_tsfield('expiry').',u.studentid,u.staff,u.admin,i.theme
FROM {usr_institution} u INNER JOIN {institution} i ON u.institution = i.name
WHERE u.usr = ?', array($userid))) {
return $institutions;
......
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