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

Multi-lang filtering broken at Frontpage News forum display

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.9, 2.0, 2.4, 2.4.6, 2.5.2
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Forum
    • Labels:
    • Testing Instructions:
      Hide
      1. Log in as admin
      2. Navigate to Site admin > Plugins > Filters > Manage filters
      3. Turn the Multi-Language Content filter to On
      4. Navigate to Site admin > Language > Language packs
      5. Ensure the English (en) and Français (fr) language packs are installed
      6. Navigate to Site admin > Front page > Front page settings
      7. For the Front page items when logged in settings, add News items
      8. Navigate to Home
      9. Under Site news, click Add a new topic
      10. Add an arbitrary title
      11. In the editor for the content, click the HTML button
      12. Paste the following content

        <p><span class="multilang" lang="en">English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english.</span><span class="multilang" lang="fr">French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. </span></p>
        

      13. Click Update
      14. Click Save changes
      15. Click Home and wait until the page is fully loaded
      16. Switch languages between English and French
      17. VERIFY that the appropriate message appears in each language
      Show
      Log in as admin Navigate to Site admin > Plugins > Filters > Manage filters Turn the Multi-Language Content filter to On Navigate to Site admin > Language > Language packs Ensure the English (en) and Français (fr) language packs are installed Navigate to Site admin > Front page > Front page settings For the Front page items when logged in settings, add News items Navigate to Home Under Site news, click Add a new topic Add an arbitrary title In the editor for the content, click the HTML button Paste the following content <p><span class="multilang" lang="en">English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english.</span><span class="multilang" lang="fr">French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. </span></p> Click Update Click Save changes Click Home and wait until the page is fully loaded Switch languages between English and French VERIFY that the appropriate message appears in each language
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-mdl-23335-master

      Description

      Multi-lang filtering is broken on the Frontpage News forum display. The problem is that the forum content is being shortened by forum_shorten_post() before the multi-lang filter can be applied through format_text().

      The current code is...

      mod/forum/lib.php ~line 3482

              $postcontent  = format_text(forum_shorten_post($post->message), $post->messageformat, $options, $course->id);
      

      An untested possible solution is change the order of format_text and forum_shorten_post functions:

      mod/forum/lib.php ~line 3482

              $postcontent  = forum_shorten_post(format_text($post->message, $post->messageformat, $options, $course->id));
      

      Replication steps:

      1. Log in as admin
      2. Navigate to Site admin > Plugins > Filters > Manage filters
      3. Turn the Multi-Language Content filter to On
      4. Navigate to Site admin > Language > Language packs
      5. Ensure the English (en) and Français (fr) language packs are installed
      6. Navigate to Site admin > Front page > Front page settings
      7. For the Front page items when logged in settings, add News items
      8. Navigate to Home
      9. Under Site news, click Add a new topic
      10. Add an arbitrary title
      11. In the editor for the content, click the HTML button
      12. Paste the following content

        <p><span class="multilang" lang="en">English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english. English english english english.</span><span class="multilang" lang="fr">French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. French french french french. </span></p>
        

      13. Click Update
      14. Click Save changes
      15. Click Home
      16. Switch languages between English and French

      Expected result: The shortened message in the appropriate language should be shown

      Actual result: The first language in the content (English) is always shown.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Nov/13