Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-35158 - Random Glossary block returns an error when you delete th…

…e linked glossary
  • Loading branch information...
commit 95a6ed773d8ae1d07cfb87afe0ae7ca806e150f8 1 parent 2d7c5ee
@grabs grabs authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 blocks/glossary_random/block_glossary_random.php
View
11 blocks/glossary_random/block_glossary_random.php
@@ -129,11 +129,6 @@ function get_content() {
$course = $this->page->course;
$modinfo = get_fast_modinfo($course);
$glossaryid = $this->config->glossary;
- $cm = $modinfo->instances['glossary'][$glossaryid];
-
- if (!has_capability('mod/glossary:view', context_module::instance($cm->id))) {
- return '';
- }
if (!isset($modinfo->instances['glossary'][$glossaryid])) {
// we can get here if the glossary has been deleted, so
@@ -147,6 +142,12 @@ function get_content() {
return $this->content;
}
+ $cm = $modinfo->instances['glossary'][$glossaryid];
+
+ if (!has_capability('mod/glossary:view', context_module::instance($cm->id))) {
+ return '';
+ }
+
if (empty($this->config->cache)) {
$this->config->cache = '';
}
Please sign in to comment.
Something went wrong with that request. Please try again.