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

Course reset does not delete forum posts properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.4
    • Fix Version/s: 1.9, 2.0
    • Component/s: Forum
    • Labels:
      None
    • Environment:
      Linux and Windows, PHP 5, MySQL 5
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      When the course reset is made post are deleted from mdl_forum_posts table (which is ok) but they are not deleted from mdl_forum_discussions. As a result the number of posts in the forum is such as if poste where still there. This number of post is displayed when user is entering the forum, which is very misleading.

      We suggest the following fix:

      in mod/forum/lib.php, in function forum_delete_userdata(...) the sql query should be:

      $sql = 'DELETE FROM '.$CFG->prefix.'forum_posts, '.$CFG->prefix.'forum_discussions
      USING '.$CFG->prefix.'forum_discussions ,
      '.$CFG->prefix.'forum_posts ,
      '.$CFG->prefix.'forum
      WHERE '.$CFG->prefix.'forum_posts.discussion = '.$CFG->prefix.'forum_discussions.id AND '.$CFG->prefix.'forum.course='.$data->courseid.' AND '.$CFG->prefix.'forum.id = '.$CFG->prefix.'forum_discussions.forum';

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              piokoch Pio Ko
              Tester:
              Nobody
              Participants:
              Component watchers:
              Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08