prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

by Tina Barclay -
Number of replies: 6
How can I prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category?

We have 160 courses in one department's category. We have been requested to give around 200 people in that department access to all courses as Department Guests. While I can do this within the category by assigning role of "Department Guest", each users "My Course" list become unwieldy and very long. Users have complained that it is to hard to distinguish courses they are Tutors on from the courses that they are Department Guests on.

An example: A single user is a Tutor on three courses, if they are assigned the role "Department Guest" within the category they now see 160 courses. The list is so long it is hard to find the courses the user is teaching on.

We are currently using Moodle 1.9

Many thanks for any ideas.
Average of ratings: -
In reply to Tina Barclay

Re: prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

by Lennon Day-Reynolds -
Unfortunately, there's no good way to do this that doesn't involve patching the Moodle core, AFAIK. The problem is that the 'course:view' capability is somewhat overloaded: it's primary purpose is to allow basic read access to a course (as your department guests likely require), but it also serves as a marker of which users are considered participants in a course.

You'll also see signs of this if you look at the course participant list, or use QuickMail or another module which displays a list of all course participants to involve in some activity: your "department guest" asignees will all show up alonside the students as full-blown participants.

The fix is easy, but affects a fairly deep piece of core logic determining who is "enrolled" in a course, and may or may not ever become part of core. (Apparently Martin isn't 100% convinced that there's a need to separate the two uses of the 'course:view' capability.)

You can fix some issues with these kind of custom, category-scope role assignments by removing and re-creating them as hidden assignments using the appropriate checkbox on the 'Assign Roles' screen. I don't think that will help with the 'My Courses' page, however.
In reply to Lennon Day-Reynolds

Re: prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

by Steve Bailey -
Hi Lennon,

Could you provide a link to this fix? I'd like to investigate it as we're having the same problem on our Moodle installation. Steve
In reply to Steve Bailey

Re: prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
The "hidden role assignments" is in the docs here
if that is what you were asking about.
In reply to Mary Cooch

Re: prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

by Steve Bailey -
Thanks Mary, but I'm actually looking for the core code change. I always use hidden assignment for category-level enrolments to avoid unwanted forum subscriptions (we're still tweaking roles at this stage).
In reply to Steve Bailey

Re: prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

by Ger Tielemans -
For the my page there is a patch where you can:
  1. sort your courses
  2. show only the top of the list (after your sort wink)
In the profile page the limit is set to 20.. (but which 20? thoughtful)


In reply to Mary Cooch

Re: prevent courses displaying on a user's My Courses list where a user is assigned the role "Department Guest" within the category

by Rambabu Dola -
Hi mary,

How to prevent show all courses to a particular user.