Course category only visible for selected users

Course category only visible for selected users

by Fabian Kaiser -
Number of replies: 4
Hi Moodlers!

I have the following situation:
Normally all Course Categories are visible for the students.
But now i want to create a special course category which should be only visible for selected users or in another way: users i give access to.

How can i do this?
Average of ratings: -
In reply to Fabian Kaiser

Re: Course category only visible for selected users

by Michael Hughes -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
On the special category revoke (i.e. prevent) the view capability for the authenticated user role (which *everyone* normally holds)

You'll then need to have a role defined that you can assign to the specific users that gives them back the view capability.

Students aren't typically in the student role outside of a course context (where they are *enrolled*) so most of the general capabilities are set via the Authenticated User role.
Average of ratings: Useful (1)
In reply to Michael Hughes

Re: Course category only visible for selected users

by Fabian Kaiser -
HI Michael!

Thank you for your help. I managed to create the custom role and i also removed the "authenticated user role" from beeing able to see this particular course category.
Now im struggling in the last step - assigning my new custom role to a user.
All i can find is the section to "assign system roles" but here my custom role does not appear.

Am i in the wrong section or how can i do this?
In reply to Fabian Kaiser

Re: Course category only visible for selected users

by Michael Hughes -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
So you need to go to /course/management.php and into the relevant category and assign the role there.

However you need to make sure on your Role definition you have set it so that it can be assigned to category contexts.
In reply to Michael Hughes

Re: Course category only visible for selected users

by Fabian Kaiser -
Thank you! It was indeed missing the possibility to assign the rule.
It is working now 😄