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

User "My Home" records are not being cleaned up on user deletion

    Details

    • Testing Instructions:
      Hide

      To test this, you need to have access to database to make sure that records are being removed.

      1. On fresh Moodle install create a test user (testuser)
      2. Log in as "testuser" and customise the blocks on their My Moodle page
      3. Run this SQL on the database "SELECT * FROM mdl_my_pages;" and the result should look similar to this (where the last record is a page for "testuser" with user id 3):

      id userid name private sortorder
      1   __default 0 0
      2   __default 1 0
      3 3 __default 1 0

      4. Delete "testuser"

      5. Run the SQL again, make sure that the record with userid 3 was removed:

      id userid name private sortorder
      1   __default 0 0
      2   __default 1 0
      Show
      To test this, you need to have access to database to make sure that records are being removed. 1. On fresh Moodle install create a test user (testuser) 2. Log in as "testuser" and customise the blocks on their My Moodle page 3. Run this SQL on the database "SELECT * FROM mdl_my_pages;" and the result should look similar to this (where the last record is a page for "testuser" with user id 3): id userid name private sortorder 1   __default 0 0 2   __default 1 0 3 3 __default 1 0 4. Delete "testuser" 5. Run the SQL again, make sure that the record with userid 3 was removed: id userid name private sortorder 1   __default 0 0 2   __default 1 0
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      master_MDL-43797

      Description

      Removal of all block instances on user pages is being handled by delete_context(CONTEXT_USER, $user->id) when user is deleted. However, if a user had a customised "My Home" page, a record will still remains in database.

      It looks like all we need to do is add:

      $DB->delete_records('my_pages', array('userid' => $user->id, 'private' => 1));

      to delete_user() method. We will submit proposed fix in a bit.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Mar/14