diff --git a/mod/wiki/editcomments.php b/mod/wiki/editcomments.php index 0a87d0d826bf7..5023bc75b5cbd 100644 --- a/mod/wiki/editcomments.php +++ b/mod/wiki/editcomments.php @@ -64,6 +64,9 @@ if (!$comment = $DB->get_record('comments', array('id' => $commentid))) { throw new \moodle_exception('invalidcomment'); } + if ($USER->id != $comment->userid) { + throw new \moodle_exception('cannotviewpage', 'wiki'); + } } $editcomments->set_page($page); diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index 6f61dd06261e8..c6b0222afc9fb 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -835,7 +835,7 @@ private function edit_comment_form($com) { if ($this->format == 'html') { $com->action = 'edit'; - $com->entrycomment_editor['text'] = $com->content; + $com->entrycomment_editor['text'] = clean_text($com->content, $this->format); $com->commentoptions = array('trusttext' => true, 'maxfiles' => 0); $this->form->set_data($com);