the "forum" table harcoded. Simplify a bit. Now seems to work
fine with every mod.
global $CFG;
- if ($records = get_records_sql("SELECT f.id, cm.visible
+ if ($records = get_records_sql("SELECT cm.instance, cm.visible
FROM {$CFG->prefix}course_modules cm,
- {$CFG->prefix}forum f,
{$CFG->prefix}modules m
WHERE cm.course = '$module->course' AND
cm.module = m.id AND
m.name = '$moduletype' AND
- cm.instance = f.id AND
- f.id = '$module->id'")) {
+ cm.instance = '$module->id'")) {
foreach ($records as $record) { // there should only be one - use the first one
return $record->visible;