Skip to content

Commit

Permalink
mod-forum MDL-24628 Properly setting up course and cm on PAGE
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Oct 22, 2010
1 parent 9e6aa5e commit 34563b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mod/forum/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
}

// Ensure lang, theme, etc. is set up properly. MDL-6926
$PAGE->set_course($course);
$PAGE->set_cm($cm, $course, $forum);

$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
Expand Down Expand Up @@ -251,6 +251,9 @@
} else {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
}

$PAGE->set_cm($cm, $course, $forum);

if (!($forum->type == 'news' && !$post->parent && $discussion->timestart > time())) {
if (((time() - $post->created) > $CFG->maxeditingtime) and
!has_capability('mod/forum:editanypost', $modcontext)) {
Expand Down

0 comments on commit 34563b3

Please sign in to comment.