Upload block settings

Admin tools ::: tool_uploadblocksettings
Maintained by Eoin Campbell
This plugin allows administrators to upload a CSV file containing block settings for courses. You can add or delete blocks, so the tool enables you to apply a default set of blocks for some or all courses on a site. You can also reset the set of course blocks to the default for that course format.
Latest release:
41 sites
7 fans
Moodle 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11

The Upload Block settings plugin allows administrators to add multiple blocks to a set of courses in a single batch operation. This is particularly useful for existing sites with a large number of courses, where you can delete obsolete blocks and add new default blocks to every course.

You can also reset course blocks to the defined default set for the course type, see Block Layout.

Use the command Site administration > Courses > Upload block settings to upload a CSV file containing lines of the form:

operation, course shortname, block name, region, weight

Lines beginning with a '#' or ';' character are comments, and skipped.
Each line of the file contains one record.
Each record is a series of data in a fixed order separated by commas.
The required fields are operation, course shortname, block, region, weight.
The allowed operations are add, del(ete), and res(et).
The allowed regions are side-pre and side-post.
The allowed weights are -10 to 10 (0 is neutral).


Screenshot #0


Eoin Campbell (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Tue, Jun 19, 2018, 9:50 PM
    Approval issue created: CONTRIB-7340
  • Wed, Jul 11, 2018, 4:37 PM

    Thanks Eoin for sharing the plugin with the community. Please refer to the to feedback provided in the tracker approval issue.

  • Wed, Jul 18, 2018, 1:38 PM

    Thanks again Eoin. Please note the master branch on your Github repository seems to contain some important recent fixes. Please consider releasing a new version of your plugin ASAP.

  • Mon, Jun 29, 2020, 6:05 AM
    Awesome! Thanks. We were looking for a way to standardize courses over Covid-19 distance learning. This allowed me to make a single upload to standardize everything at one.
  • Tue, Jul 28, 2020, 4:19 AM
    I am attempting to use this plugin, but I'm not able to get any courses updated to show a custom block. For every line I get the error that fields can't be blank, but they aren't. I'm not sure what I'm doing wrong. Can this only be used with Moodle standard core blocks?
  • Wed, Jul 29, 2020, 4:49 AM
    Unfortunately, I continue to have trouble with this plugin. If I leave no spaces before or after the commas, then I get the error that the fields can't be blank. If I leave a space after each comma, it tells me it can't find the course sites because it's not stripping the space from the front of the course shortname. I've gone to your git repo and installed from there, but I continue to get the same errors. I'm using Moodle 3.8.3. Are there any other suggestions?
  • Wed, Jul 29, 2020, 5:53 AM
    Can you post the CSV file you are trying to import so that I can take a look? Also post the exact error message you see. Are you editing the CSV file directly, or saving an Excel file in CSV format? Excel sometimes adds extra columns you don't expect. The plugin can be used with any installed block, not just core blocks. You also need to make sure the block name matches an existing block.
  • Wed, Jul 29, 2020, 11:27 PM
    Yes, I can!

    The first error with no spaces around the commas are:
    Line 1 [{$a->oplabel}]: Too few columns, expecting 5. Skipped.
    Line 2 [Add]: Fields cannot be blank: block ( carlresources), course ($a->coursename), region ($a->region), weight ($a->weight). Skipped.
    Line 3 [Add]: Fields cannot be blank: block ( carlresources), course ($a->coursename), region ($a->region), weight ($a->weight). Skipped.

    When I add a space after the commas, I get this error:
    Line 1 [{$a->oplabel}]: Too few columns, expecting 5. Skipped.
    Line 2 [Add]: Course " AFST100-00-f20" not found. Skipped.
    Line 3 [Add]: Course " AFST400-00-f20" not found. Skipped.
    Line 4 [Add]: Course " AMST115-00-f20" not found. Skipped.
    Line 5 [Add]: Course " AMST225-00-f20" not found. Skipped.

    I don't see a way to attached a file here, but I did attempt to find hidden characters in a plain text editor. Here is a sample of what I'm attempting to use. The block is one that I've made for our own instance.

  • Thu, Jul 30, 2020, 12:40 AM
    The problem seems to be the weight of 0. Try changing this to 1 instead.
Please login to post comments