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

馋奶兔 提交于 2019-12-25 05:26:10

问题


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 :

  • As an administrator, turn on the editing on the front page and add the block you wish to make sticky.
  • For Where this block appears>Page contexts, choose 'Display throughout the entire site'.
  • Decide other settings according to your preference and save.
  • The block will now appear on all pages of your Moodle.

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


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/30288299/moodle-add-a-new-block-as-admin-for-all-users-to-appear-on-all-pages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!