CONTACT US

Auto dock all side blocks in Moodle

--- Advertisement ---

Post Pages - Post Inline - WIRIS

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.

  • 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:

5 Responses

  1. Great information, this solution worked on Moodle 2.9.1+ with Clean Theme and saved a me so much time with my first Moodle project… Thank you

Leave a Reply

Your email address will not be published.

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

The Latest

The eLearn Podcast

--- Advertisement ---

Post Pages - Sidebar 4 - CourseMerchant

--- Advertisement ---

Post Pages - Sidebar 7 - Titus Learning

--- Advertisement ---

Post Pages - Sidebar 5 - Edwiser (RemUI)

Subscribe to our newsletter

Education technology has the power to change lives. 

To get the latest news, information and resources about online learning from around the world by clicking on the button below.