mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-25944 fix broken images in forum emails and fix invalid $group variable name
This commit is contained in:
parent
99faefb29b
commit
18ff4d427e
1 changed files with 11 additions and 10 deletions
|
@ -980,15 +980,15 @@ function forum_cron() {
|
|||
function forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $bare = false) {
|
||||
global $CFG, $USER;
|
||||
|
||||
if (!isset($userto->viewfullnames[$forum->id])) {
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if (!isset($userto->viewfullnames[$forum->id])) {
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
|
||||
} else {
|
||||
$viewfullnames = $userto->viewfullnames[$forum->id];
|
||||
}
|
||||
|
||||
if (!isset($userto->canpost[$discussion->id])) {
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$canreply = forum_user_can_post($forum, $discussion, $userto, $cm, $course, $modcontext);
|
||||
} else {
|
||||
$canreply = $userto->canpost[$discussion->id];
|
||||
|
@ -1014,6 +1014,9 @@ function forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfro
|
|||
}
|
||||
}
|
||||
|
||||
// add absolute file links
|
||||
$post->message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', $modcontext->id, 'mod_forum', 'post', $post->id);
|
||||
|
||||
$posttext .= "\n---------------------------------------------------------------------\n";
|
||||
$posttext .= format_string($post->subject,true);
|
||||
if ($bare) {
|
||||
|
@ -2979,16 +2982,17 @@ function forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfro
|
|||
|
||||
global $CFG, $OUTPUT;
|
||||
|
||||
if (!isset($userto->viewfullnames[$forum->id])) {
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if (!isset($userto->viewfullnames[$forum->id])) {
|
||||
$viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
|
||||
} else {
|
||||
$viewfullnames = $userto->viewfullnames[$forum->id];
|
||||
}
|
||||
|
||||
// add absolute file links
|
||||
$post->message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', $modcontext->id, 'mod_forum', 'post', $post->id);
|
||||
|
||||
// format the post body
|
||||
$options = new stdClass();
|
||||
$options->para = true;
|
||||
|
@ -3020,10 +3024,7 @@ function forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfro
|
|||
if (isset($userfrom->groups)) {
|
||||
$groups = $userfrom->groups[$forum->id];
|
||||
} else {
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$group = groups_get_all_groups($course->id, $userfrom->id, $cm->groupingid);
|
||||
$groups = groups_get_all_groups($course->id, $userfrom->id, $cm->groupingid);
|
||||
}
|
||||
|
||||
if ($groups) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue