]> git.mjollnir.org Git - moodle.git/commitdiff
Better handling of forum id/object
authormoodler <moodler>
Thu, 14 Sep 2006 07:13:08 +0000 (07:13 +0000)
committermoodler <moodler>
Thu, 14 Sep 2006 07:13:08 +0000 (07:13 +0000)
mod/forum/post.php

index 987c197d60a83a1d2c41f9ab5b6697e257ca5d26..4b3ee5ab2c17e38aeefeacf0e7067c04395e1826 100644 (file)
         if (!$course = get_record('course', 'id', $post->course)) {
             error('Could not find specified course!');
         }
+
+        if (!empty($forum)) {     // Check the forum id and change it to a full object
+            if (! $forum = get_record('forum', 'id', $forum)) {
+                error('The forum number was incorrect');
+            }
+        }
         
         if (!empty($course->lang)) {           // Override current language
             $CFG->courselang = $course->lang;
                 error("You can not update this post");
             }
 
-            if (get_field('forum', 'type', 'id', $forum->id) == 'news' && !$post->parent) {
+            if ($forum->type == 'news' && !$post->parent) {
                 $updatediscussion = new object;
                 $updatediscussion->id = $post->discussion;
                 if (empty($post->timestartdisabled)) {
             $discussion->intro = $post->message;
             $newstopic = false;
 
-            if (get_field('forum', 'type', 'id', $forum->id) == 'news' && !$post->parent) {
+            if ($forum->type == 'news' && !$post->parent) {
                 $newstopic = true;
             }
             if ($newstopic && empty($post->timestartdisabled)) {
     print_footer($course);
 
 
-?>
\ No newline at end of file
+?>