mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-31636 Comments - Call display callback when adding a new comment.
This commit is contained in:
parent
6b969e14b5
commit
52cb014ea3
@ -530,7 +530,6 @@ class comment {
|
||||
$url = new moodle_url('/user/view.php', array('id'=>$u->id, 'course'=>$this->courseid));
|
||||
$c->profileurl = $url->out(false);
|
||||
$c->fullname = fullname($u);
|
||||
$c->time = userdate($c->timecreated, get_string('strftimerecent', 'langconfig'));
|
||||
$c->content = format_text($c->content, $c->format, $formatoptions);
|
||||
$c->avatar = $OUTPUT->user_picture($u, array('size'=>18));
|
||||
|
||||
@ -629,12 +628,27 @@ class comment {
|
||||
$cmt_id = $DB->insert_record('comments', $newcmt);
|
||||
if (!empty($cmt_id)) {
|
||||
$newcmt->id = $cmt_id;
|
||||
$newcmt->time = userdate($now, get_string('strftimerecent', 'langconfig'));
|
||||
$newcmt->strftimeformat = get_string('strftimerecent', 'langconfig');
|
||||
$newcmt->fullname = fullname($USER);
|
||||
$url = new moodle_url('/user/view.php', array('id' => $USER->id, 'course' => $this->courseid));
|
||||
$newcmt->profileurl = $url->out();
|
||||
$newcmt->content = format_text($newcmt->content, $format, array('overflowdiv'=>true));
|
||||
$newcmt->avatar = $OUTPUT->user_picture($USER, array('size'=>16));
|
||||
|
||||
$commentlist = array($newcmt);
|
||||
|
||||
if (!empty($this->plugintype)) {
|
||||
// Call the display callback to allow the plugin to format the newly added comment.
|
||||
$commentlist = plugin_callback($this->plugintype,
|
||||
$this->pluginname,
|
||||
'comment',
|
||||
'display',
|
||||
array($commentlist, $this->comment_param),
|
||||
$commentlist);
|
||||
$newcmt = $commentlist[0];
|
||||
}
|
||||
$newcmt->time = userdate($newcmt->timecreated, $newcmt->strftimeformat);
|
||||
|
||||
return $newcmt;
|
||||
} else {
|
||||
throw new comment_exception('dbupdatefailed');
|
||||
|
Loading…
x
Reference in New Issue
Block a user