Logged in user unable to view Guest Category and Courses

Logged in user unable to view Guest Category and Courses

by David Broad -
Number of replies: 4

On my site I have a Guest category and Guest courses which are displayed fine when someone views them as a guest.

But when a Student logs in they are unable to view the Guest Category/Courses and this message is displayed:


You don't have permission to view courses here

More information about this error


I was under the impression that Guest items are automatically viewable by anyone who was logged in as well as guest users. Can anything happen to hide them from logged in users?

Thanks for your help


Average of ratings: -
In reply to David Broad

Re: Logged in user unable to view Guest Category and Courses

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi David,

There is a new capability in Moodle 3.7 onwards, 'View list of courses you are not enrolled in' (Capabilities/moodle/category:viewcourselist) which you need to make sure is allowed for the Authenticated user role, for users to be able to view the guest category and courses.

Average of ratings: Useful (1)
In reply to Helen Foster

Re: Logged in user unable to view Guest Category and Courses

by David Broad -

Hi Helen,

Thanks so much for your reply , that worked perfectly! 

I had tried adding the 'Student' role there but it had no effect, 'Authenticated User' was what was needed.

Thanks!

In reply to David Broad

Re: Logged in user unable to view Guest Category and Courses [Solved]

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi David,

Good to hear that you've got things working now! (I didn't have chance to test my suggested solution!)

The reason why allowing the capability for the student role didn't work, is because some capabilities only work in certain contexts. moodle/category:viewcourselist only works in the site context (system role or authenticated user role) or category context (role in a category). Generally the student role is assigned in the course context (enrolling a user in a course).

Average of ratings: Useful (1)
In reply to Helen Foster

Re: Logged in user unable to view Guest Category and Courses [Solved]

by David Broad -

Thanks for explaining the reason why, I still getting my head round roles and capabilities so that is some useful insight!