Hi, is it possible to control what a user sees on Moodle (eg. which modules, blocks), depending on the user type (student, teacher, and so)?
And if it's possible, how do I do that? is there a table to check or a theme variable to hide/show info depending on user type?
Thanks for your help,
TB
Dear Tony Burgos,
This is a basic level of abstraction,Yes of course it is possible.
You need to look here for blocks, and you can have a look at the Modules section under Site Administratio menu
Peace - Ravishankar Somasundaram
This is a basic level of abstraction,Yes of course it is possible.
You need to look here for blocks, and you can have a look at the Modules section under Site Administratio menu
Peace - Ravishankar Somasundaram
Yes, somewhat.
For activities (module instances):
Hide the module. Now only users with viewhiddenactivities capability (I forget if it is 'teachers' or 'editing teachers' that get this by default, but you can configure) can see it. You can override that capability on an individual module so that a particular one can be seen by some other role, or else not be seen by a role that normally would see it.
For blocks:
I don't think this is really possible in general for existing blocks unless they have their own 'view' capability, which they usually don't. It's easy to implement for your own blocks (just check for a capability and return empty string if they don't have it).
However, if you aren't concerned about security in this regard, you can probably hide blocks using CSS. Create a custom theme, and within your theme's header.php, add code which checks for a capability. If that capability is not present, add a stylesheet like
<style type="text/css">
.block-whatever {
display:none;
}
</style>
You get the idea...
I may be mistaken, or not know about some other technique, so please others feel free to correct me if necessary..!
--sam
For activities (module instances):
Hide the module. Now only users with viewhiddenactivities capability (I forget if it is 'teachers' or 'editing teachers' that get this by default, but you can configure) can see it. You can override that capability on an individual module so that a particular one can be seen by some other role, or else not be seen by a role that normally would see it.
For blocks:
I don't think this is really possible in general for existing blocks unless they have their own 'view' capability, which they usually don't. It's easy to implement for your own blocks (just check for a capability and return empty string if they don't have it).
However, if you aren't concerned about security in this regard, you can probably hide blocks using CSS. Create a custom theme, and within your theme's header.php, add code which checks for a capability. If that capability is not present, add a stylesheet like
<style type="text/css">
.block-whatever {
display:none;
}
</style>
You get the idea...
I may be mistaken, or not know about some other technique, so please others feel free to correct me if necessary..!
--sam
You can use role overrides to prevent users from a specific role from seeing a block.