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

Hiding a Sticky Block Can Cause Other Blocks to Disappear

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.10
    • Fix Version/s: None
    • Component/s: Blocks
    • Labels:

      Description

      Hiding a sticky block can cause other sticky blocks to disappear when there are course-level blocks in the same column.

      To reproduce:
      1. Go to site admin block > Modules > Blocks > Sticky blocks. Add a few sticky blocks to the right column of the course page. It doesn't matter what the blocks are. For this example, let's say there are three blocks called A, B, and C.

      2. Go to any course and add at least one block to the right column.

      3. Notice that the course has all three sticky blocks plus the blocks you added to the course.

      4. Go back to the Sticky Blocks page and hide sticky block A by clicking the eyeball.

      5. Return to the same course as step 2 and notice that sticky blocks A and C have both disappeared.

      I have tracked this down to a problem with the weight values of the sticky blocks. With all sticky blocks visible, the weight values are 0, 1, and 2 with an array length of 3. When Block A is hidden, the weight values of the sticky blocks are just 1 and 2 with an array length of 2. The function blocks_get_by_page_pinned() gets the course blocks and, expecting the array keys for the stickies to be 0 and 1, starts inserting the course blocks beginning with key 2. This overwrites Sticky Block C and makes it disappear from the course page.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              abgreeve Adrian Greeve
              Reporter:
              cfollin Chris Follin
              Peer reviewer:
              Andrew Davis Andrew Davis
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              20 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: