Moodle 2.7: use Upload Courses to create more than one instance of Self Enrolment

Moodle 2.7: use Upload Courses to create more than one instance of Self Enrolment

by J Stringer -
Number of replies: 4

Hi,

I am trying to use Upload Courses to create a course with two instances of self enrolment and two separate enrolment keys: 1 for a student, 1 for a teacher.

Here's an example of a CSV:

shortname,fullname,category,summary,enrolment_1,enrolment_1_role,enrolment_1_password,enrolment_2,enrolment_2_role,enrolment_2_password

courserestored21,Course restored21,34,a summary,self,teacher,12345,self,teacher,56789

However, when I do this, it only creates the second instance enrolment_2. It's as if it's overwriting the first.

Does anyone know what needs to be done to create two self enrolment instances?

I'm creating over 50 courses and I really don't want to have to manually add a second instance of self enrolment (all with different keys).

thanks very much!

Average of ratings: -
In reply to J Stringer

Re: Moodle 2.7: use Upload Courses to create more than one instance of Self Enrolment

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Both are called "teacher" - should one not be called "student"?

In reply to Mary Cooch

Re: Moodle 2.7: use Upload Courses to create more than one instance of Self Enrolment

by J Stringer -

Thanks for the reply. I should have looked at the file I was uploading. In this instance they're both named teacher but I tried many different combinations and the second always overwrote the first. I have since tried creating groups with enrolment keys and bulk restoring from a backup, but this doesn't work either. The group/enrolment key is still there but I can't get the "Use group enrolment keys" to stick because enrolment methods do not save when backing up a course and I have no idea how to enable "Use group enrolment keys" using the Upload Courses CSV. There are a number of enrolment fields but "Use group enrolment keys" isn't one of them. Or perhaps it is, but how to access this is not indicated in the documentation.

In reply to J Stringer

Re: Moodle 2.7: use Upload Courses to create more than one instance of Self Enrolment

by J Stringer -

For what it's worth, I was able to find out how to change the instance name of the enrolment by reading some source code I found here: http://stackoverflow.com/questions/25325314/how-to-add-cohort-to-a-course-programmatically. Using Enrolment_1_name will do this. However, I still cannot create more than one instance of self enrolment.

On the other hand, I was able to change the site-wide setting for course creation so that it defaults Yes to allow to use Group Enrolment Keys at "Home / ▶ Site administration / ▶ Plugins / ▶ Enrolments / ▶ Self enrolment".

So for now, I'll create one editing teacher role with a unique enrolment key for each course but I'll use the same group enrolment key for all students.

I would still like to  know how to do this if anyone can figure it out.

In reply to J Stringer

Re: Moodle 2.7: use Upload Courses to create more than one instance of Self Enrolment

by J Stringer -

Thought I found a solution, but turns out I haven't. Because the default role is now set to be editing teacher, anyone who enrols to the course using a group enrolment key is enrolled as a teacher. Does anyone know if custom roles can be created system wide for course enrolment? So for example, having Manual, Self, Cohort Sync, other?