Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

"MDL-6926, force language in forum module"

  • Loading branch information...
commit ee5719014ced56cfdba52082e509ce177c53de52 1 parent 73d0da2
dongsheng authored
Showing with 23 additions and 7 deletions.
  1. +3 −1 mod/forum/discuss.php
  2. +7 −2 mod/forum/post.php
  3. +13 −4 mod/forum/view.php
View
4 mod/forum/discuss.php
@@ -28,9 +28,11 @@
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
error('Course Module ID was incorrect');
}
+
+ require_course_login($course, true, $cm);
+
// move this down fix for MDL-6926
require_once("lib.php");
- require_course_login($course, true, $cm);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
$canviewdiscussion = has_capability('mod/forum:viewdiscussion', $modcontext);
View
9 mod/forum/post.php
@@ -4,7 +4,6 @@
require_once('../../config.php');
require_once('lib.php');
- require_once('post_form.php');
$reply = optional_param('reply', 0, PARAM_INT);
$forum = optional_param('forum', 0, PARAM_INT);
@@ -146,6 +145,9 @@
error("Incorrect cm");
}
+ // call course_setup to use forced language, MDL-6926
+ course_setup($course->id);
+
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -444,11 +446,14 @@
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
+ // setup course variable to force form language
+ // fix for MDL-6926
+ course_setup($course->id);
+ require_once('post_form.php');
$mform_post = new mod_forum_post_form('post.php', array('course'=>$course, 'coursecontext'=>$coursecontext, 'modcontext'=>$modcontext, 'forum'=>$forum, 'post'=>$post));
if ($fromform = $mform_post->get_data()) {
-
require_login($course, false, $cm);
if (empty($SESSION->fromurl)) {
View
17 mod/forum/view.php
@@ -26,6 +26,11 @@
if (! $forum = get_record("forum", "id", $cm->instance)) {
error("Forum ID was incorrect");
}
+
+ // move require_course_login here to use forced language for course
+ // fix for MDL-6926
+ require_course_login($course, true, $cm);
+
$strforums = get_string("modulenameplural", "forum");
$strforum = get_string("modulename", "forum");
$buttontext = update_module_button($cm->id, $course->id, $strforum);
@@ -39,9 +44,6 @@
error("Forum is misconfigured - don't know what course it's from");
}
- $strforums = get_string("modulenameplural", "forum");
- $strforum = get_string("modulename", "forum");
-
if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
$buttontext = update_module_button($cm->id, $course->id, $strforum);
} else {
@@ -51,6 +53,13 @@
$buttontext = "";
}
+ // move require_course_login here to use forced language for course
+ // fix for MDL-6926
+ require_course_login($course, true, $cm);
+
+ $strforums = get_string("modulenameplural", "forum");
+ $strforum = get_string("modulename", "forum");
+
} else {
error('Must specify a course module or a forum ID');
}
@@ -60,7 +69,7 @@
}
- require_course_login($course, true, $cm);
+
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
Please sign in to comment.
Something went wrong with that request. Please try again.