General developer forum

How do I hide a block or what have you?

 
 
Picture of Liam Cuff
How do I hide a block or what have you?
 

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

 
Average of ratings: -
Davo
Re: How do I hide a block or what have you?
Group DevelopersGroup Particularly helpful Moodlers

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).

 
Average of ratings: -