Permalink
Browse files

Merge branch 'em_MDL-25944_20_forummail' of git://github.com/skodak/m…

…oodle
  • Loading branch information...
2 parents 395181f + 18ff4d4 commit 78106a24addfd14c08602adbf7147f2eabf82bd4 @stronk7 stronk7 committed Feb 18, 2011
Showing with 11 additions and 10 deletions.
  1. +11 −10 mod/forum/lib.php
View
@@ -980,15 +980,15 @@ function forum_cron() {
function forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $bare = false) {
global $CFG, $USER;
+ $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
+
if (!isset($userto->viewfullnames[$forum->id])) {
- $modcontext = get_context_instance(CONTEXT_MODULE, $cm->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;
+ $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
+
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);
$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) {

0 comments on commit 78106a2

Please sign in to comment.