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

Block with 'my' set to false in applicable_formats() still gets a message if myaddinstance is not defined

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.5, 2.8.2, 2.9
    • Fix Version/s: 2.7.6, 2.8.4
    • Component/s: Blocks
    • Labels:
    • Testing Instructions:
      Hide

      0) Debugging enabled

      1) Add an instance, if missing, of the "course_summary" block to frontpage.

      2) Edit its settings to display throughout the whole site.

      3) Go to /my and verify the block is displayed showing the site information.

      4) Click "customize this page". You should not get a warning output.

      5) Repeat 1-4 with the "site_main_menu" block.

      6) Add some other block to /my and check that still works fine.

      Show
      0) Debugging enabled 1) Add an instance, if missing, of the "course_summary" block to frontpage. 2) Edit its settings to display throughout the whole site. 3) Go to /my and verify the block is displayed showing the site information. 4) Click "customize this page". You should not get a warning output. 5) Repeat 1-4 with the "site_main_menu" block. 6) Add some other block to /my and check that still works fine.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-48910_block_my

      Description

      According to https://docs.moodle.org/dev/Blocks#db.2Faccess.php blocks that set 'my' to false in applicable_formats() do not need to define myaddinstance. However if the block does not define the capability going to /my and turning on customization causes this to be displayed.

      The block spam_deletion does not define the standard capability block/spam_deletion:myaddinstance
      line 578 of /blocks/moodleblock.class.php: call to debugging()
      line 551 of /blocks/moodleblock.class.php: call to block_base->has_add_block_capability()
      line 1124 of /lib/blocklib.php: call to block_base->user_can_addto()
      line 1104 of /lib/blocklib.php: call to block_manager->user_can_delete_block()
      line 248 of /blocks/moodleblock.class.php: call to block_manager->edit_controls()
      line 962 of /lib/blocklib.php: call to block_base->get_content_for_output()
      line 1014 of /lib/blocklib.php: call to block_manager->create_block_contents()
      line 392 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
      line 45 of /theme/clean/layout/columns3.php: call to core_renderer->standard_head_html()
      line 940 of /lib/outputrenderers.php: call to include()
      line 864 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
      line 167 of /my/index.php: call to core_renderer->header()

      This can be reproduced using the spam deletion block. https://github.com/moodlehq/block-spam_deletion.git. Note that MDLSITE-3748 is introducing 'my' = false. If that MDLSITE issue has not been resolved yet you will need to manually make the change.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              andyjdavis Andrew Davis
              Reporter:
              andyjdavis Andrew Davis
              Peer reviewer:
              Mark Nelson
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Frédéric Massart
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Mar/15