Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-41369

Message screen does not use the course language

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: 2.6
    • Component/s: Course, Messages
    • Labels:
    • Testing Instructions:
      Hide
      1. Create several courses with several participants, some with capability 'moodle/site:viewparticipants' and 'moodle/course:viewparticipants', some without
      2. Change the language of one course and theme of another course
      3. Login as one user, try sending messages to another user inside the course and from users list. Note that there are many ways to send message to the user - from participants/users list click on user name, there will be link to send message under avatar and in navigation block. Also one can navigate to recent conversations and courses participants from dropdown on message page.
      4. Inside the messaging try to select different items from dropdown
      5. During the test make sure that navigation path is correct (both navbar and navigation block), messaging inside the course are displayed with course environment (language, theme, blocks)
      Show
      Create several courses with several participants, some with capability 'moodle/site:viewparticipants' and 'moodle/course:viewparticipants', some without Change the language of one course and theme of another course Login as one user, try sending messages to another user inside the course and from users list. Note that there are many ways to send message to the user - from participants/users list click on user name, there will be link to send message under avatar and in navigation block. Also one can navigate to recent conversations and courses participants from dropdown on message page. Inside the messaging try to select different items from dropdown During the test make sure that navigation path is correct (both navbar and navigation block), messaging inside the course are displayed with course environment (language, theme, blocks)
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:
      wip-MDL-41369-master
    • Sprint:
      BACKEND Sprint 4

      Description

      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;

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marina Marina Glancy
              Reporter:
              amrigo Angelo Rigo
              Peer reviewer:
              Rajesh Taneja Rajesh Taneja
              Integrator:
              Dan Poltawski Dan Poltawski
              Tester:
              Damyon Wiese Damyon Wiese
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona), Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/13