How do I hide a block or what have you?

How do I hide a block or what have you?

از Liam Cuff در
Number of replies: 1

Seriously I have no idea how to hide anything (such as a block) from one user but show it for another (I'm trying to give staff secret menus so they can pass files to each other, make them hidden etc). This tutorial (

) is great for 1.9 but I'm maybe using version (actually there doesn't even from my research too be able to find what version I'm using) 2.4 and I'm having some difficulty. I've been trying to hide a block from a teacher but to no avail. Please help - this is something really simple and yet so important. Thanks.

 

Liam

میانگین امتیازات: -
In reply to Liam Cuff

Re: How do I hide a block or what have you?

از Davo Smith در
تصویر Core developers تصویر Particularly helpful Moodlers تصویر Peer reviewers تصویر Plugin developers

In the get_content() function:

Check the capability of the user that you are interested in.

Return NULL if they do not have the capability that allows them to view the block.

(Note the block will still appear to teachers if they switch editing on, but it will be hidden when editing is off).