]> git.mjollnir.org Git - moodle.git/commitdiff
fixed undefined modcontext in forum; merged from MOODLE_17_STABLE
authorskodak <skodak>
Sat, 21 Oct 2006 20:30:27 +0000 (20:30 +0000)
committerskodak <skodak>
Sat, 21 Oct 2006 20:30:27 +0000 (20:30 +0000)
mod/forum/post.php

index dcbbe51b8bc98b41c12ed21a216149cd80616896..b5e86fb8cc67e412e63beb5b3abf465e11957565 100644 (file)
         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)");
         }
         } 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!");