Enrolling students in multiple courses (using shortname) via file upload

Enrolling students in multiple courses (using shortname) via file upload

by HJWUCGA INC. -
Number of replies: 3
Hello everyone,

I believe I understand how the file upload for users. Basically, when a new user is encountered in that file, it will add it to the system and

enroll them in their course.

But what happens if I want to say enrol that user to another course in that same text file? It won't allow me to do it this way. As far as what I

know this upload is really and truly for "new" accounts not in the database and if they exist, it ignores it (if I set it to not to update their

accounts), correct?

The idea I have is to create a text file with their username, password, etc. and course shortname and upload it to the system without updating any

existing user accounts (they may already have changed their password on their own see).

Sample file:
---------------

username,password,firstname,lastname,auth,email,city,course1, type1
akim,akim,Alex,Kim,email,akim@test.com,Toronto,ACR,2
ajohnson,ajohnson,Annabelle,Johnson,email,ajohnson@test.com,Toronto,ACR,2
bcook,bcook,Bruce,Cook,email,bcook@test.com,New York,NYCUT,2
akim,akim,Alex,Kim,email,akim@test.com,Toronto,HOCKEY,2


note Alex Kim account.. I want to add him to the 2 courses, ACR and Hockey?

How can I do that?

The shortname is autogenerated from our internal database scripts so using a Moodle course ID could be difficult to map.

Thanks
Average of ratings: -
In reply to HJWUCGA INC.

Re: Enrolling students in multiple courses (using shortname) via file upload

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

If you already have an external database with all the enrolment details (student id, course name, etc.), why don't you use the external database enrolment plugin?

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: Enrolling students in multiple courses (using shortname) via file upload

by HJWUCGA INC. -
Forgive my ignorance but I didn't realize that I could use shortname as a field to reference instead of course ID?

Is that correct?

So, using my example above, I just put these fields in the database instead of a flat file, correct?

thanks
In reply to HJWUCGA INC.

Re: Enrolling students in multiple courses (using shortname) via file upload

by Lauranne Bailey -
Christopher, I use a text file upload the way you do. Here's how I enroll one student in two courses (you had a space before type 1, but that may be just in your example...):

username,password,firstname,lastname,auth,email,city,course1,type1,course2,type2
akim,akim,Alex,Kim,email,akim@test.com,Toronto,ACR,2,HOCKEY,2
ajohnson,ajohnson,Annabelle,Johnson,email,ajohnson@test.com,Toronto,ACR,2,HOCKEY,2

I haven't done this yet, but you may be able to do this as well:

username,password,firstname,lastname,auth,email,city,course1,type1
akim,akim,Alex,Kim,email,akim@test.com,Toronto,ACR,2
ajohnson,ajohnson,Annabelle,Johnson,email,ajohnson@test.com,Toronto,ACR,2
akim,akim,Alex,Kim,email,akim@test.com,Toronto,HOCKEY,2
ajohnson,ajohnson,Annabelle,Johnson,email,ajohnson@test.com,Toronto,HOCKEY,2