External database enrolment - unenrol/delete student from course after removal from external db

External database enrolment - unenrol/delete student from course after removal from external db

by KK. Morrissey -
Number of replies: 2

Hi Everyone,

We are having an issue whereby we are unable to remove students enrolled on a course when using external database enrolments with External unenrol action = Keep user enrolled.

When a user is removed from the external database, the enrolment is kept in Moodle - this is expected because of the External unenrol action = Keep user enrolled. However, we have found that there is no option thereafter to manually remove the enrolment, if we wish to do so on an adhoc basis. 

We are on Moodle 3.4 after upgrading over the summer from Moodle 3.2 and seem to remember it working differently. In Moodle 3.2 once the user was removed from the external database, and the enrolment sync script run, the option became available to delete them manually from the course (option did not exist while in the external database), i.e. the student now had an x when viewed in the enrolled users in the course.


Does anyone know how to unenrol a student from a course when they were:

1. Enrolled by external database AND

2. Have the following set in Moodle on the external database enrolment settings: External unenrol action = Keep user enrolled AND

3. Have been removed from the external source database?


Our environment is:

  • Moodle 3.4.4+(Build 20180720)
  • MariaDB 10.2.16
  • PHP 7.1.19


Any help is much appreciated smile


Many thanks,

K



Average of ratings: -
In reply to KK. Morrissey

Re: External database enrolment - unenrol/delete student from course after removal from external db

by Chris Canning -

Hi K,

Oddly enough I have posted a message on the forum about a similar issue from a slightly different perspective.

We also upgraded from 3.2 to 3.4 this summer and use External database enrolment with the 'Keep user enrolled' field selected.

However, we have never been able to manually unenrol students who have been enrolled via this method. I have only ever been able to manually unenrol students if they have manually been enrolled (or self enrolled) onto the course in question. 

So, not much help I'm afraid!

Chris 

In reply to Chris Canning

Re: External database enrolment - unenrol/delete student from course after removal from external db

by KK. Morrissey -

Hi Chris,

Thanks for taking the time to reply and adding your own experience.

I have managed to install a test instance of Moodle 3.2 to check this and you are correct. It does behave as you say so it seems my recollection was wrong. What I seem to have been recalling was likely to have been with the setting External unenrol action = Disable course enrolment where once the user was removed from the external database, and the enrolment sync script run, the option became available to delete them manually from the course. This I confirmed in the test Moodle 3.2 instance.


It seems a bit strange that there is no override possible if you somehow lose the enrolments in the external database allowing permanent enrolments as thereafter there is no option to unenrol.


Thanks again.


Best regards,

K.