mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-50811-master' of git://github.com/cameron1729/moodle
This commit is contained in:
commit
3adcb91d55
1 changed files with 9 additions and 0 deletions
|
@ -29,6 +29,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||
|
||||
require_once($CFG->dirroot . '/mod/forum/lib.php');
|
||||
require_once($CFG->dirroot . '/repository/lib.php');
|
||||
require_once($CFG->libdir . '/completionlib.php');
|
||||
|
||||
/**
|
||||
* A Handler to process replies to forum posts.
|
||||
|
@ -244,6 +245,14 @@ class reply_handler extends \core\message\inbound\handler {
|
|||
$event->add_record_snapshot('forum_discussions', $discussion);
|
||||
$event->trigger();
|
||||
|
||||
// Update completion state.
|
||||
$completion = new \completion_info($course);
|
||||
if ($completion->is_enabled($cm) && ($forum->completionreplies || $forum->completionposts)) {
|
||||
$completion->update_state($cm, COMPLETION_COMPLETE);
|
||||
|
||||
mtrace("--> Updating completion status for user {$USER->id} in forum {$forum->id} for post {$addpost->id}.");
|
||||
}
|
||||
|
||||
mtrace("--> Created a post {$addpost->id} in {$discussion->id}.");
|
||||
return $addpost;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue