While searching on the internet, I came up to a solution to dock all the side blocks on your Moodle site by default which I thought to share with all of my readers as it is a very handy and useful tip. Thanks to Jaswant Tak, for sharing such a nice tip through his blog.
So, coming back to the point, to hide all the side blocks on your Moodle site you need to change one of the core files of Moodle, which is not recommended. If you still wants to continue with it then please keep a track of all the changes in core Moodle files before upgrading your Moodle site to a new version.

Post Pages - Post Inline - WIRIS
  • Open the file your_moodle_site/blocks/moodleblock.class.php in any text editor like Notepad++.
  • Find the function html_attributes (In my case it is on line number 411)
  • Change the line having the code:

if ($this->instance_can_be_docked() && get_user_preferences(‘docked_block_instance_’.$this->instance->id,0)) {

with

if ($this->instance_can_be_docked() && get_user_preferences(‘docked_block_instance_’.$this->instance->id,1)) {

(in my case it is line number 420)

  • Save changes.

This will dock all the side blocks except for the admin user.
If you want to skip any particular block from docking  then you can use the negated && (AND) condition in the statement as follows:
Let’s say you don’t want to dock the “Login” block then change the same line with this code:
if ($this->instance_can_be_docked() && get_user_preferences(‘docked_block_instance_’.$this->instance->id, 1) && $this->name() != ‘login’) {
And save changes.

Docked Blocks
All side blocks are docked by default

Thanks Jaswant Tak for sharing such a nice tips with whole Moodle community.
References:

Previous articleMoodle 2.9 now in code freeze
Next articleWhat’s coming in Moodle 2.9 that you should be aware of?

5 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.