Self-enrolment and Moodle Networking

Self-enrolment and Moodle Networking

by Pete Skipworth -
Number of replies: 1
Hello,

Can anyone tell me if this is possible ?

At the moment, all of our courses are set to enrollable - any local user can self-enrol to any course.

We've now added a second Moodle server to the equation. We only want users coming in from this server to be able to self-enrol in a single course on the original server. Access should be denied (or at least self-enrolment should be denied) to them for all other courses.

I'm new to Moodle but am a PHP coder, so even if a solution requires some hacking of the code, a pointer in the right direction would be fantastic.
Average of ratings: -
In reply to Pete Skipworth

Re: Self-enrolment and Moodle Networking

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers

You need to modify the manual enrolment plugin to only let local users self-enrol to the course. Right now it doesn't check if the user is local or remote, so any user can self-enrol.

You need to modify print_entry() member function to check if $USER->mnethostid is the same as $CFG->mnet_localhost_id. If they are, then it's a local user and should be allowd to self-enrol. If it isn't, then you prevent self-enrolment.

Once you have that in place, you can enable remote enroling via MNET as detailed in http://docs.moodle.org/en/MNet#Peer_to_Peer_Network , step 3. Note that you don't have to set it up both ways A<-->B, you can just set it up B-->A or A-->B.

Saludos. Iñaki.