Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-29892 grade: added a check to prevent hidden courses appearing on…

… student overview reports
  • Loading branch information...
commit 31eae0eb1798642a2cabff2fdcf88af721632544 1 parent 216f6d8
Andrew Davis authored

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  grade/report/overview/lib.php
7  grade/report/overview/lib.php
@@ -119,7 +119,14 @@ public function fill_table() {
119 119
                 if (!$course->showgrades) {
120 120
                     continue;
121 121
                 }
  122
+
122 123
                 $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
  124
+
  125
+                if (!$course->visible && !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
  126
+                    // The course is hidden and the user isn't allowed to see it
  127
+                    continue;
  128
+                }
  129
+
123 130
                 $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
124 131
                 $courselink = html_writer::link(new moodle_url('/grade/report/user/index.php', array('id' => $course->id, 'userid' => $this->user->id)), $courseshortname);
125 132
                 $canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext);

0 notes on commit 31eae0e

Please sign in to comment.
Something went wrong with that request. Please try again.