Index: showentry.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/glossary/showentry.php,v retrieving revision 1.40.2.1 diff -u -r1.40.2.1 showentry.php --- showentry.php 22 Nov 2009 10:34:56 -0000 1.40.2.1 +++ showentry.php 5 Dec 2009 10:26:27 -0000 @@ -42,13 +42,19 @@ } if ($entries) { - $modinfo = get_fast_modinfo($course); foreach ($entries as $key => $entry) { + // Need to get the course where the entry is, + // in order to check for visibility/approve permissions there + if (!$entrycourse = get_record("course", "id", $entry->courseid)) { + error('Invalid entry course id'); + } + $modinfo = get_fast_modinfo($entrycourse); // make sure the entry is visible if (empty($modinfo->cms[$entry->cmid]->uservisible)) { unset($entries[$key]); continue; } + // make sure the entry is approved (or approvable by current user) if (!$entry->approved and ($USER->id != $entry->userid)) { $context = get_context_instance(CONTEXT_MODULE, $entry->cmid); if (!has_capability('mod/glossary:approve', $context)) { @@ -56,7 +62,6 @@ continue; } } - //$entries[$key]->footer = "
"; // Could not get this to work satisfactorily in all cases - Martin $entries[$key]->footer = "» wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">".format_string($entry->glossaryname,true)."
"; add_to_log($entry->courseid, "glossary", "view entry", "showentry.php?eid=$entry->id", $entry->id, $entry->cmid); }