-
Bug
-
Resolution: Fixed
-
Minor
-
2.4.5
-
MOODLE_24_STABLE
-
MOODLE_26_STABLE
-
wip-
MDL-41369-master -
-
BACKEND Sprint 4
If you view a user profile from your course and send him a private message the course language would be another than the language of the course.
Steps
- Create a course and choose english for Language.
- Choose Portuguese (or another) for the default language of the site.
- List the participants of the course.
- Choose one, click to see his profile.
- Send him a message from the Send message link in user/view.php
- The message form would have the Portuguese language (it was expected to be English language).
Why this is bad ?
If you invite an English teacher to run a moodle course in Brazil for example, he will see some screens in Portuguese.
Fix:
In the file user/view.php add the course parameter &course='.$COURSE->id.':
// Print messaging link if allowed
if (isloggedin() && has_capability('moodle/site:sendmessage', $usercontext)
&& !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id)) {
echo '<div class="messagebox">';
echo '<a href="'.$CFG->wwwroot.'/message/index.php?id='.$user->id.'&course='.$COURSE->id.'">'.get_string('messageselectadd').'</a>';
echo '</div>';
Finally in the file message/index.php add these lines:
$id = optional_param('course','',PARAM_TEXT);
$courselang = $DB->get_field('course','lang',array('id'=>$id));
$SESSION->lang = $courselang;