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
+?>