Merge branch 'MDL-47208' of git://github.com/aolley/moodle

This commit is contained in:
Damyon Wiese 2014-09-15 12:25:32 +08:00
commit 3a46c04459

View File

@ -205,6 +205,13 @@ class info_module extends info {
// As a result we cannot take short cuts any longer and must get
// standard modinfo.
$modinfo = get_fast_modinfo($cm->course, $userid);
return $modinfo->get_cm($cm->id)->uservisible;
$cms = $modinfo->get_cms();
if (!isset($cms[$cm->id])) {
// In some cases this might get called with a cmid that is no longer
// available, for example when a module is hidden at system level.
debugging('info_module::is_user_visible called with invalid cmid ' . $cm->id, DEBUG_DEVELOPER);
return false;
}
return $cms[$cm->id]->uservisible;
}
}