Bhargava
Bhargava

Reputation: 421

Moodle Add a new block as Admin for all users , to appear on all pages

I have a created a simple custom block that outputs Html. I want to add it in front page context with page->context "Display throughout the entire site". I googled and found the procedure :

I am just not able to add the block with context front page. Hence, I do not get "Display throughout the entire site".

Also it is not added for students and teachers.

Please help.

Moodle version : 2.8.5

Upvotes: 1

Views: 5330

Answers (2)

user3520540
user3520540

Reputation: 35

I had a similar question - and after a day of scratching my head, i found the answer.

Because of the setting Site Administration/Navigation/ is set to redirect everyone to dashboard - there is no way to get to the frontpage by typing in the domain name, or clicking on the logo or any normal way one expects to get to the front page except by logging out.

Turns out, there is one more block menu called 'Navigation'. If you've ever clicked the minimize toggle on it, good luck. In that Navigation menu, there is 'Site Home' Even though one would expect that 'Site Home' would probably bring one back to the dashboard again, this one will in fact, bring you to the front page - with full administrative rights.

Hope this helps anyone who is scratching their heads on trying to modify the front page.

Upvotes: 1

Russell England
Russell England

Reputation: 10241

You might need to add this to class block_yourblockname in /blocks/yourblockname/block_yourblockname.php

function applicable_formats() {
    return array('all' => true);
}

Applicable formats restricts the block so it only appears on certain pages.

https://docs.moodle.org/dev/Blocks#Authorized_Personnel_Only

Upvotes: 1

Related Questions