Commit 05c276cb authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

fix so pages work with groups that have been marked as deleted

parent 90b1fda5
......@@ -176,7 +176,8 @@ function get_associated_groups($userid=0) {
UNION
SELECT gm.group, 'tutor' AS type
FROM {group_member} gm WHERE gm.member = ? AND gm.tutor = 1
) AS a ON a.group = g.id AND g.deleted = ?";
) AS a ON a.group = g.id
WHERE g.deleted = ?";
return get_records_sql_assoc($sql, array($userid, $userid, $userid, $userid, 0));
}
......
......@@ -352,7 +352,8 @@ function display_name($user, $userto=null, $nameonly=false) {
$sql = 'SELECT g1.member
FROM {group_member} g1
JOIN {group_member} g2
ON g1.group = g2.group
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))) {
return $user->preferredname . ($nameonly ? '' : ' (' . $user->firstname . ' ' . $user->lastname . ')');
......
......@@ -45,7 +45,7 @@ $count = count_records('view', 'owner', $userid);
$viewdata = get_records_sql_array('SELECT v.id,v.title,v.startdate,v.stopdate,v.description,g.name
FROM {view} v
LEFT OUTER JOIN {group} g ON v.submittedto = g.id
LEFT OUTER JOIN {group} g ON (v.submittedto = g.id AND g.deleted = 0)
WHERE v.owner = ' . $userid . '
ORDER BY v.title', '', $offset, $limit);
......@@ -100,7 +100,7 @@ if ($viewdata) {
if (!$tutorgroupdata = @get_records_sql_array('SELECT g.id, g.name
FROM {group_member} u
INNER JOIN {group} g ON u.group = g.id
INNER JOIN {group} g ON (u.group = g.id AND g.deleted = 0)
INNER JOIN {group_member} t ON t.group = g.id
WHERE u.member = ' . $userid . '
AND t.tutor = 1
......
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