How do I hide a block or what have you?

How do I hide a block or what have you?

par Liam Cuff,
Nombre de réponses : 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

Moyenne des évaluations  -
En réponse à Liam Cuff

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

par Davo Smith,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Peer reviewers Avatar 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).