How do I set the default blocks for all courses?

How do I set the default blocks for all courses?

autor Glenn Pillsbury -
Počet odpovedí: 16

Using Moodle 2.1.2.  When I create a new course, there are four blocks on by default: "Search forums", "Latest news", "Upcoming events", and "Recent activity".  How do I make sure those don't appear by default?

Instead, I'd like other blocks to appear by default (Calendar and QuickMail).

In 1.9 there was a way to set some course defaults, but I can't find those in 2.x.

Thanks for your help!

Priemer hodnotení : -
V odpovedi na Glenn Pillsbury

Re: How do I set the default blocks for all courses?

autor Glenn Pillsbury -

I take it from the deafening silence on this question that there is in fact no way to set a default course layout.  That's too bad and a strange deletion of a nice 1.9 feature by the Moodle crew.

Will put this suggestion into the tracker.

V odpovedi na Glenn Pillsbury

Re: How do I set the default blocks for all courses?

autor Tim Hunt -
Obrázok: Core developers Obrázok: Documentation writers Obrázok: Particularly helpful Moodlers Obrázok: Peer reviewers Obrázok: Plugin developers

It is possible to set default course block in 2.x, in exactly the same way as in 1.9. Read config-dist.php.

V odpovedi na Tim Hunt

Re: How do I set the default blocks for all courses?

autor Glenn Pillsbury -

Thanks for that information.  I was refering more to the "sticky" blocks interface in 1.9 (Modules > Blocks > Sticky Blocks) which seems to have been removed from 2.x.

V odpovedi na Glenn Pillsbury

Re: How do I set the default blocks for all courses?

autor Mary Cooch -
Obrázok: Documentation writers Obrázok: Moodle HQ Obrázok: Particularly helpful Moodlers Obrázok: Testers Obrázok: Translators
V odpovedi na Mary Cooch

Re: How do I set the default blocks for all courses?

autor Glenn Pillsbury -

Thanks.  Will take a look at that, too.

V odpovedi na Mary Cooch

Re: How do I set the default blocks for all courses?

autor Zaid Ghansar -

I installed a block and configured it to show on every course page, but it does not show up.

Is there some other settings in back end?

V odpovedi na Zaid Ghansar

Re: How do I set the default blocks for all courses?

autor Zaid Ghansar -

NVM, I was adding it in a course and thought it will show up in other courses.

It needed to be added on main page.

V odpovedi na Zaid Ghansar

Re: How do I set the default blocks for all courses?

autor Mark Jones -

i cannot add quickmail from the main page...any ideals?

V odpovedi na Glenn Pillsbury

Re: How do I set the default blocks for all courses?

autor Daniel Kaelin -

Glen, Did you figure this out? 

I'm also trying to figure out how to prevent the auto creation of these 4 blocks. 

I set site wide sticky blocks and they are conflicting with these blocks resulting in duplicate blocks. The main reason I don't want them auto created is you can't specify the default weight. When moodle auto creates these blocks in new shells the weights are 0,1,2,3. 

V odpovedi na Daniel Kaelin

Re: How do I set the default blocks for all courses?

autor Daniel Kaelin -

Well I ended up answering my own question through some experimentation. 

If you want to prevent Moodle from installing any blocks by default to new courses you have to add this line to your config.php.


$CFG->defaultblocks_override = ' ';

It requires the space in between the singe quotes. 

V odpovedi na Daniel Kaelin

Re: How do I set the default blocks for all courses?

autor Brian Merritt -
Obrázok: Particularly helpful Moodlers

Which course formats are you using Daniel?

You are better to change the course format to the blocks you actually want. For example, in Topics Format (course/format/topics/lib.php)

public function get_default_blocks() {
global $CFG;
if (!empty($CFG->defaultblocks)){
return blocks_parse_default_blocks_list($CFG->defaultblocks);
}
$blocknames = array(
BLOCK_POS_LEFT => array(),
BLOCK_POS_RIGHT => array('search_forums', 'news_items', 'calendar_upcoming', 'recent_activity')
);
return $blocknames;
}

Just change the names on the blocks.  To be safe, you can create your own course format and do other modifications to Topics and call it "danielstopics"

V odpovedi na Brian Merritt

Re: How do I set the default blocks for all courses?

autor Daniel Kaelin -

I feel much more comfortable with my method because the line goes in the config.php which won't be overwritten on upgrades. 

If you are managing a lot of Moodle instances it can be tedious tracking customizations on the actual Moodle installation files. 

V odpovedi na Brian Merritt

Re: How do I set the default blocks for all courses?

autor Elizabeth Dalton -

It's good to know where this is controlled, but having to edit php to set default blocks seems inconvenient (especially for those of us who have contracted for hosting services with a Moodle Partner -- they don't generally let us edit cfg files.) I think a request for a feature is in order here....

And in fact, it exists: MDL-34718