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

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.5, 2.8.2, 2.9
    • 2.7.6, 2.8.4
    • Blocks
    • MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MDL-48910_block_my
    • 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.

    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

              andyjdavis Andrew Davis
              andyjdavis Andrew Davis
              Mark Nelson Mark Nelson
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Frédéric Massart Frédéric Massart
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Mar/15