Info
Content

Web Service Course or Activity not Accessible


If you are using a web service function like enrol_manual_enrol_users to enrol users into a course, you may come across the following exception:

{
    "exception": "require_login_exception",
    "errorcode": "requireloginerror",
    "message": "Course or activity not accessible."
}

This can happen even if you have put the user in a role with the enrol/manual:enrol capability.

Generally it means the user needs to also have access at the course context, i.e. to have a role in the course that allows them to enrol other users. This might be set per course in the Course Participants area, or it might be assigned at a system or course category context.

No Comments
Back to top