Mass enroll students by category (not by course), is it possible?

Mass enroll students by category (not by course), is it possible?

by Maximiliano Corbo -
Number of replies: 7

Hey there, greetings. I have over 200 courses. I meticulously made sure to create my courses into their corresponding category and then bulk uploaded the users into their corresponding category.

The structure is like this:

2026 / 7° grade / courses / 24 courses.
2026 / 7° grade / cohorts / 4 courses with varying members each.

I went to each course and noticed they each have 0 participants. How do I mass enroll each cohort to their correspoding courses?

I know this is possible going course by course, but with over 200 courses this is simply insane.

How do I do this? I already enabled students to be available at categories but when I want to bulk assign users to the role it does it by users, not by cohorts.

Average of ratings: -
In reply to Maximiliano Corbo

Mass enroll students by category (not by course), is it possible?

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

When you say you "bulk uploaded the users into their corresponding category" what do you mean by that? Do you mean a category cohort, or assigning roles at the category level?

If the latter, this won't result in visible course enrolments, only access - I think it's intended for admin type roles only, not students.

If you're using cohorts, then you'll need to add a cohort enrolment instance to each page, but, of course, that's a one-time operation. You'll just be maintaining the cohorts.

Mark

In reply to Mark Sharp

Mass enroll students by category (not by course), is it possible?

by Maximiliano Corbo -
Hello. I noticed my message is a little confusing, and then I realized I cannot edit posted messaged.

Yes, I meant cohorts. I created cohorts, uploaded the corresponding users to each and assigned them to the corresponding category.

I hear you, I really do, here's the thing however: I have over 200 courses, this is a school. Going course by course assigning cohorts is a chore, it's a time waster. I don't understand how there isn't a simply button to sync already assigned cohorts to every course inside each category. Regarding the feeling that is a one-time operation... Yeah, yearly. It really baffles me there's no automatic process for this, surely I can't be the only one facing this. I uploaded the courses, I took the time to create and assign the categories, then the cohorts, this should be just one click, instead is 200+
Average of ratings: Useful (2)
In reply to Maximiliano Corbo

Mass enroll students by category (not by course), is it possible?

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It's been 12 years since I last did this, but I used to do Moodle course enrollments via a spreadsheet program, Excel at first then the last few years I used Libre Office Calc. I would get a data dump from the school management software. I then used various macros and cell formulas to create a correctly formatted CSV file to use to upload the students with temp passwords and put them in their courses and even into assigned groups in each course. Once the file was created, if I got a new student, it was very easy to add them in and re-upload the file with the setup in the upload, to only check for new students. Once I got it working the first year, it only took a few moments to refresh with a new data dump for the new years students and class enrollments.
In reply to Maximiliano Corbo

Mass enroll students by category (not by course), is it possible?

by Marvin H -
Picture of Particularly helpful Moodlers
I would try to solve this by using moosh(https://moosh-online.com/). With this tool you can make operations directly from the commandline.
The tool has a command called cohort-enrol (see https://moosh-online.com/commands/#cohort-enrol) which is able to enrole a cohort to a course.
If you can get a logic to pair the course-ids with your cohorts you could write a small script that can do this task for you.
Average of ratings: Useful (2)
In reply to Maximiliano Corbo

Mass enroll students by category (not by course), is it possible?

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

I had a quick rummage through the plugin repository and found this one which might suit your needs: https://moodle.org/plugins/tool_uploadenrolmentmethods which allows you to create plugin instances via a spreadsheet. Should save you a bunch of clicks.

Note: I've not tried this method myself, so give it a go on your local dev first.

I think a lot of places, we do, use some sort of Student Records System that either directly enrols, or makes use of the database or csv(Flatfile) enrolment methods. With database and csv enrolment, you don't need to add an instance, it's done automatically. It also has the benefit of controlling enrolments by a single source of truth. If you can I would definitely look into those methods.

Average of ratings: Useful (3)