Web services and role_assign

Web services and role_assign

by John Schilling -
Number of replies: 4

I'm trying to figure out how to enroll users into a course. I'm trying to figure out exactly how I get the context id for a course that the function moodle_role_assign requires . It doesn't appear there is any way to do this. I see work is being done on a new function (http://tracker.moodle.org/browse/MDL-26250), but it too appears to require a context id. Am I overlooking a function to get a context id for a course?

Average of ratings: -
In reply to John Schilling

Re: Web services and role_assign

by Jérôme Mouneyrac -

Hi John, we are using courseid in MDL-26250, no worries.

In reply to Jérôme Mouneyrac

Re: Web services and role_assign

by Basil Gohar -
That's great for enrolling users. What about unenrolling them? The only external service function currently available for that is the simple role_unassign one under /enrol/externallib.php, and it, too, requires a contextid to function.

Will there be a simple unenroll service as there is for enrolling?
In reply to Basil Gohar

Re: Web services and role_assign

by Lorenz Ulrich -

Use the OK tech webservices, there you get all the stuff you need:

unenrol_students

and so far. The smoothest way to enrol users to courses is to use

moodle_enrol_manual_enrol_users

Good luck!