From e80ca6c658ffcafc38e2f5d9b93808eeb4416c9e Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 21 Oct 2006 20:30:27 +0000 Subject: [PATCH] fixed undefined modcontext in forum; merged from MOODLE_17_STABLE --- mod/forum/post.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/forum/post.php b/mod/forum/post.php index dcbbe51b8b..b5e86fb8cc 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -435,12 +435,6 @@ if (! $forum = get_record("forum", "id", $discussion->forum)) { error("The forum number was incorrect ($discussion->forum)"); } - if (!($forum->type == 'news' && !$post->parent && $discussion->timestart > time())) { - if (((time() - $post->created) > $CFG->maxeditingtime) and - !has_capability('mod/forum:editanypost', $modcontext)) { - error( get_string("maxtimehaspassed", "forum", format_time($CFG->maxeditingtime)) ); - } - } if (! $course = get_record("course", "id", $discussion->course)) { error("The course number was incorrect ($discussion->course)"); } @@ -449,6 +443,12 @@ } else { $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id); } + if (!($forum->type == 'news' && !$post->parent && $discussion->timestart > time())) { + if (((time() - $post->created) > $CFG->maxeditingtime) and + !has_capability('mod/forum:editanypost', $modcontext)) { + error( get_string("maxtimehaspassed", "forum", format_time($CFG->maxeditingtime)) ); + } + } if (($post->userid <> $USER->id) and !has_capability('mod/forum:editanypost', $modcontext)) { error("You can't edit other people's posts!"); -- 2.39.5