Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-42495 lesson Prevent coding error for invalid user

  • Loading branch information...
commit 217c5d820805d8f74518ed202e3f62f045fc25f1 1 parent ea04def
Michael Aherne micaherne authored
Showing with 6 additions and 17 deletions.
  1. +6 −17 mod/lesson/essay.php
23 mod/lesson/essay.php
View
@@ -268,23 +268,12 @@
$ufields = user_picture::fields('u');
list($sort, $sortparams) = users_order_by_sql('u');
$params = array_merge($params, $sortparams);
- if (!empty($cm->groupingid)) {
- $params["groupingid"] = $cm->groupingid;
- $sql = "SELECT DISTINCT $ufields
- FROM {lesson_attempts} a
- INNER JOIN {user} u ON u.id = a.userid
- INNER JOIN {groups_members} gm ON gm.userid = u.id
- INNER JOIN {groupings_groups} gg ON gm.groupid = gg.groupid AND gg.groupingid = :groupingid
- WHERE a.lessonid = :lessonid
- ORDER BY $sort";
- } else {
- $sql = "SELECT DISTINCT $ufields
- FROM {user} u,
- {lesson_attempts} a
- WHERE a.lessonid = :lessonid and
- u.id = a.userid
- ORDER BY $sort";
- }
+ $sql = "SELECT DISTINCT $ufields
+ FROM {user} u,
+ {lesson_attempts} a
+ WHERE a.lessonid = :lessonid and
+ u.id = a.userid
+ ORDER BY $sort";
if (!$users = $DB->get_records_sql($sql, $params)) {
$mode = 'none'; // not displaying anything
$lesson->add_message(get_string('noonehasanswered', 'lesson'));
Please sign in to comment.
Something went wrong with that request. Please try again.