How do I hide a block or what have you?

How do I hide a block or what have you?

av Liam Cuff -
Antall svar: 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

Gjennomsnittlig vurdering: -
Som svar til Liam Cuff

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

av Davo Smith -
Bilde av Core developers Bilde av Particularly helpful Moodlers Bilde av Peer reviewers Bilde av 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).