Moodle

Course reset does not delete forum posts properly

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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';

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

fixed in cvs - see MDL-7028
thanks for the report

Show
Petr Škoda (skodak) added a comment - fixed in cvs - see MDL-7028 thanks for the report

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: