Skip to content

Commit 929e718

Browse files
committed
add url rewriter correctly
1 parent ac244ed commit 929e718

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

classes/post_form.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public static function editor_options(context_module $context, $postid) {
158158
'maxbytes' => $maxbytes,
159159
'trusttext' => true,
160160
'return_types' => FILE_INTERNAL | FILE_EXTERNAL,
161-
'subdirs' => file_area_contains_subdirs($context, 'mod_forum', 'post', $postid),
161+
'subdirs' => file_area_contains_subdirs($context, 'mod_moodleoverflow', 'post', $postid),
162162
];
163163
}
164164
}

locallib.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
global $CFG;
3636
require_once(dirname(__FILE__) . '/lib.php');
3737
require_once($CFG->libdir . '/portfoliolib.php');
38-
38+
require_once($CFG->dirroot.'/lib/portfolio/formats.php');
3939
/**
4040
* Get all discussions in a moodleoverflow instance.
4141
*
@@ -1160,7 +1160,6 @@ function moodleoverflow_print_post($post, $discussion, $moodleoverflow, $cm, $co
11601160
$post->course = $course->id;
11611161
$post->moodleoverflow = $moodleoverflow->id;
11621162
$mcid = $modulecontext->id;
1163-
$post->message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', $mcid, 'mod_moodleoverflow', 'post', $post->id);
11641163

11651164
// Check if the user has the capability to see posts.
11661165
if (!moodleoverflow_user_can_see_post($moodleoverflow, $discussion, $post, $cm)) {
@@ -1450,8 +1449,12 @@ function moodleoverflow_print_post($post, $discussion, $moodleoverflow, $cm, $co
14501449
$mustachedata->canreview = capabilities::has(capabilities::REVIEW_POST, $modulecontext);
14511450
$mustachedata->withinreviewperiod = $reviewable;
14521451

1453-
// Prepare the post.
1454-
$options = (array) portfolio_format_text_options() + ['context' => $modulecontext];
1452+
// Prepare the post by formatting it's content.
1453+
$post->message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', $mcid, 'mod_moodleoverflow',
1454+
'post', $post->id, ['includetoken' => true]);
1455+
$options = new stdClass();
1456+
$options->para = true;
1457+
$options->context = $modulecontext;
14551458
$mustachedata->postcontent = format_text($post->message, $post->messageformat, $options);
14561459

14571460
// Load the attachments.

0 commit comments

Comments
 (0)