help with unenroll code

help with unenroll code

by Jamal Aruna -
Number of replies: 5
hello, Our teachers tend to do a lot of unenrolment activities because of the volume of students we have and its not ok for us to activate the unenrol button for the students.so we were thinking of building a custom page which lists all names of all students with an unenrol button in front of each name and all the teacher has to do is just click all the the way down the list instead of searching through the participants list(which grows everyday) to do the unenrol.Could anyone please help with code to attach to the button that will do the unenrolment please? Thanx
Average of ratings: -
In reply to Jamal Aruna

Re: help with unenroll code

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

1.9 or 2.0?

Anyway, the best way to answer this question is to look at the code that forms the standard Moodle interface for doing this, and see which library functions that uses. So, in 1.9, look at admin/role/assign.php, and in 2.0 look at enrol/users.php.

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: help with unenroll code

by Jamal Aruna -

Thanx Tim,

its 1.9...do i just add the course id and user id as part of the url that will call the unenrol.php script?would that work?mixed

In reply to Jamal Aruna

Re: help with unenroll code

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

No. That is not what I meant.

You need to look at the code in that php file to see what to do. Basically, you need to call the role_unassign function with the right arguments.

In reply to Tim Hunt

Re: help with unenroll code

by Jamal Aruna -

smile i think i get you now...i will soon let you know how far i went.thanks for the pointer Tim.