Skip to content

Commit

Permalink
forum update calendar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Syxton committed Aug 31, 2021
1 parent 2c47928 commit b5508f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@

// Commit transaction and finish up.
$transaction->allow_commit();

// Rebuild all course cache / calendar dates
rebuild_course_cache($course->id);
$task = new \core\task\refresh_mod_calendar_events_task();
$task->set_custom_data(array('courseid' => $course->id));
\core\task\manager::queue_adhoc_task($task, true);

redirect($PAGE->url, get_string('changessaved'));
}

Expand Down
13 changes: 13 additions & 0 deletions mod/forumdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,17 @@ public function validate_dates(cm_info $cm, array $dates) {
}
return $errors;
}

public function save_dates(cm_info $cm, array $dates) {
global $DB, $COURSE, $CFG;
parent::save_dates($cm, $dates);

require_once($CFG->dirroot.'/mod/forum/locallib.php');
$forum = $DB->get_record('forum', ['id' => $cm->instance]);
$forum->cmidnumber = $cm->id;

// Update the calendar and grades.
forum_update_calendar($forum, $cm->id);
forum_grade_item_update($forum);
}
}

0 comments on commit b5508f9

Please sign in to comment.