1. What Is a Moodle Cohort?
A cohort in Moodle is a collection of users created at the site or category level. You can think of it as a central group of users that can be reused across many courses.
Example cohorts:
OneMembership
DevOps Students
SRE Premium Members
Corporate Batch 2026
AWS Training Learners
Moodle documentation explains that cohorts are different from course groups. A cohort exists for enrolment purposes across Moodle, while a group exists only inside a specific course. Cohorts can be brought into one or more courses in bulk. (Moodle Docs)
Simple meaning:
Cohort = Site/category-level user group
Group = Course-level user group
Example:
OneMembership cohort
↓
Course 1
Course 2
Course 3
Course 4
If you add a user to the OneMembership cohort, that user can automatically receive access to all courses where this cohort has been synced.
2. What Is Cohort Sync?
Cohort sync is an enrolment method. It automatically enrols members of a cohort into a course. If a user is added to the cohort, the user is enrolled in the course. If the user is removed from the cohort, the user can be unenrolled from the course depending on plugin settings. (Moodle Docs)
Flow:
User added to Cohort
↓
Cohort sync enrolment method
↓
User gets course access
Example:
Cohort: OneMembership
Course: Docker Masterclass
Role: Student
Once Cohort sync is added to the course, all users inside OneMembership get access to Docker Masterclass.
3. What Is Course Meta Link?
Course meta link is another enrolment method. It synchronises enrolments and roles from a source course to a target course. (Moodle Docs)
Flow:
Source Course users
↓
Course meta link
↓
Target Course access
Example:
Source Course: DevOps Membership Course
Target Course: Kubernetes Course
If a student is enrolled in DevOps Membership Course, Course meta link can automatically enrol that same student into Kubernetes Course.
This is useful when one course acts as the “main enrolment course” and other courses depend on it.
4. Cohort Sync vs Course Meta Link
| Feature | Cohort Sync | Course Meta Link |
|---|---|---|
| Main source | Cohort | Another course |
| Best for | Memberships, batches, departments, customer groups | Linking enrolments between courses |
| Dependency | Depends on cohort | Depends on source course |
| Risk if source deleted | Cohort deletion may affect sync | Deleted source course can break linked enrolment references |
| Best scale usage | Very good for many courses | Useful, but can become messy at scale |
| Example | OneMembership → 100 courses | Course A users → Course B access |
The most important difference:
Cohort Sync = User group controls course access
Course Meta Link = Another course controls course access
For most membership-style platforms, training portals, corporate LMS sites, and paid access models, Cohort sync is usually cleaner.
5. When Should You Use Cohorts?
Use cohorts when you want to manage users centrally.
Good use cases:
One paid membership gives access to many courses
One corporate client has 500 learners
One training batch needs access to selected courses
One department needs access to internal learning modules
One subscription plan unlocks multiple courses
Example:
Cohort: OneMembership
Courses:
- DevOps Foundation
- Docker Training
- Kubernetes Training
- Jenkins Training
- Terraform Training
Now instead of manually enrolling users in every course, you only manage users inside the cohort.
This is the clean model:
Add user to cohort once
↓
User gets access to all synced courses
6. When Should You Use Course Meta Link?
Use Course meta link when enrolment in one course should automatically give access to another course.
Good use cases:
A main course has child courses
A program course controls access to module courses
A master course enrolment should unlock supporting courses
A certification path has linked sub-courses
Example:
Main Course: Full Stack Developer Program
Linked Courses:
- HTML Course
- CSS Course
- JavaScript Course
- Laravel Course
- React Course
The enrolment flow becomes:
Student enrolled in Full Stack Developer Program
↓
Automatically enrolled in linked module courses
Course meta link can be useful, but it creates a dependency on the source course. If that source course is deleted or corrupted, target courses may have broken enrolment references.
7. Best Practice Recommendation
For your case, where you have a cohort like:
OneMembership
and you want to assign access across many courses, the better structure is:
OneMembership Cohort
↓
Cohort Sync
↓
All membership courses
Avoid using this unless you specifically need course-to-course dependency:
Old Master Course
↓
Course Meta Link
↓
Other Courses
For large Moodle systems with hundreds of courses, Cohort sync is easier to audit, easier to bulk update, and easier to explain to administrators.
Part 1: How to Create and Use Cohorts in Moodle
Step 1: Create a Cohort
Go to:
Site administration → Users → Accounts → Cohorts
Click:
Add new cohort
Add details:
Name: OneMembership
Cohort ID: OneMembership
Context: System
Visible: Yes
Moodle allows cohorts to be created at the system level or within a course category. A system cohort is available site-wide, while a category cohort is available within that category context. (Moodle Docs)
Important: Always set a clear Cohort ID. Moodle upload tools often use the cohort ID, not only the cohort display name. Moodle documentation warns that upload files work on the cohort ID, not the cohort name. (Moodle Docs)
Good naming:
Cohort name: OneMembership
Cohort ID: OneMembership
Avoid blank IDs.
Step 2: Add Users to a Cohort
You can add users manually:
Site administration → Users → Accounts → Cohorts
Then click the members icon and add users.
For bulk assignment, Moodle supports adding users to cohorts using upload users CSV. The upload format can include fields such as username and cohort1. (Moodle Docs)
Example CSV:
username,cohort1
rajesh,OneMembership
amit,OneMembership
priya,OneMembership
Step 3: Enable Cohort Sync Plugin
Go to:
Site administration → Plugins → Enrolments → Manage enrol plugins
Enable:
Cohort sync
Moodle documentation says Cohort sync must be enabled by an administrator before it can be used in courses. (Moodle Docs)
Step 4: Add Cohort Sync to a Course
Open the course:
Course → Participants → Enrolment methods
Choose:
Add method → Cohort sync
Select:
Cohort: OneMembership
Role: Student
Click:
Add method
Now all users in OneMembership will be enrolled into that course.
Part 2: How to Add One Cohort to Hundreds of Courses
If you have hundreds of courses, do not add Cohort sync one by one manually.
Use Moodle’s Upload courses tool.
Moodle’s Upload courses tool allows administrators or users with the correct capability to create/update courses using CSV, and it supports course enrolment fields. (Moodle Docs)
Go to:
Site administration → Courses → Upload courses
Use a CSV like this:
shortname,enrolment_1,enrolment_1_cohortidnumber,enrolment_1_role
DEVOPS101,cohort,OneMembership,student
DOCKER101,cohort,OneMembership,student
K8S101,cohort,OneMembership,student
JENKINS101,cohort,OneMembership,student
Recommended upload options:
Upload mode: Update existing courses only
Update mode: Update with CSV data
Preview: Yes
This is the best Moodle-native way to add one cohort to many existing courses.
Part 3: Course Meta Link Setup
Step 1: Enable Course Meta Link Plugin
Go to:
Site administration → Plugins → Enrolments → Manage enrol plugins
Enable:
Course meta link
Moodle documentation says Course meta link must be enabled in enrolment plugin settings before use. (Moodle Docs)
Step 2: Add Course Meta Link to a Target Course
Open the target course:
Course → Participants → Enrolment methods
Choose:
Add method → Course meta link
Then select the source course.
Example:
Source Course: DevOps Membership Course
Target Course: Kubernetes Course
Now users enrolled in the source course are synchronised into the target course.
Moodle documentation notes that Course meta link synchronises enrolments and roles from source course to target course; by default, role assignments from the source course are synchronised unless roles are excluded in plugin settings. (Moodle Docs)
Part 4: Common Mistake — Using Course Meta Link Like a Membership System
Many Moodle admins create a “master course” and link all other courses to it:
Master Course
↓
Course 1
Course 2
Course 3
Course 4
This works, but it is not always the best design.
If the master course is deleted, hidden incorrectly, restored badly, or corrupted, linked target courses may have broken enrolment references.
Better design for membership:
OneMembership Cohort
↓
Course 1
Course 2
Course 3
Course 4
This is simpler because the cohort is the access control object, not a course.
Part 5: Troubleshooting “Can’t Find Data Record in Database”
If you deleted old source/master courses and then some courses show this error:
Can't find data record in database.
when opening:
Participants → Enrolment methods
then the likely cause is a broken Course meta link enrolment record.
Moodle is trying to load an old linked source course, but that course no longer exists.
SQL: Find Broken Course Meta Links
SELECT
e.id AS enrol_instance_id,
e.courseid AS target_course_id,
target.shortname AS target_shortname,
target.fullname AS target_course_name,
e.customint1 AS missing_source_course_id
FROM mdl_enrol e
JOIN mdl_course target ON target.id = e.courseid
LEFT JOIN mdl_course source ON source.id = e.customint1
WHERE e.enrol = 'meta'
AND source.id IS NULL;
Meaning:
target_course_id = course where enrolment page may be broken
missing_source_course_id = deleted course previously used as source
Before fixing anything, take a database backup.
mysqldump -u DBUSER -p DBNAME > moodle_before_fix_broken_meta_links.sql
Then remove broken enrolment instances using Moodle’s API, not direct SQL deletion.
Part 6: Useful SQL Reports for Moodle Cohorts and Meta Links
1. Find Courses Where OneMembership Is Already Added
SELECT
c.id AS course_id,
c.shortname,
c.fullname,
cc.name AS category_name,
e.id AS enrol_instance_id,
e.status
FROM mdl_course c
JOIN mdl_enrol e
ON e.courseid = c.id
JOIN mdl_cohort ch
ON ch.id = e.customint1
LEFT JOIN mdl_course_categories cc
ON cc.id = c.category
WHERE e.enrol = 'cohort'
AND (
ch.name = 'OneMembership'
OR ch.idnumber = 'OneMembership'
)
ORDER BY cc.name, c.shortname;
2. Find Courses Where OneMembership Is Not Added
SELECT
c.id AS course_id,
c.shortname,
c.fullname,
cc.name AS category_name
FROM mdl_course c
LEFT JOIN mdl_course_categories cc
ON cc.id = c.category
WHERE c.id <> 1
AND NOT EXISTS (
SELECT 1
FROM mdl_enrol e
JOIN mdl_cohort ch
ON ch.id = e.customint1
WHERE e.courseid = c.id
AND e.enrol = 'cohort'
AND (
ch.name = 'OneMembership'
OR ch.idnumber = 'OneMembership'
)
)
ORDER BY cc.name, c.shortname;
3. Find Course Meta Links
SELECT
e.id AS enrol_instance_id,
target.id AS target_course_id,
target.shortname AS target_course_shortname,
target.fullname AS target_course_name,
source.id AS source_course_id,
source.shortname AS source_course_shortname,
source.fullname AS source_course_name
FROM mdl_enrol e
JOIN mdl_course target ON target.id = e.courseid
JOIN mdl_course source ON source.id = e.customint1
WHERE e.enrol = 'meta'
ORDER BY source.fullname, target.fullname;
4. Find Duplicate-Looking Course Names by First 4 Characters
SELECT
LEFT(REGEXP_REPLACE(LOWER(TRIM(c.fullname)), '[^a-z0-9]', ''), 4) AS first_4_normalized_chars,
COUNT(*) AS total_courses,
GROUP_CONCAT(c.id ORDER BY c.id SEPARATOR ' | ') AS course_ids,
GROUP_CONCAT(c.shortname ORDER BY c.id SEPARATOR ' | ') AS shortnames,
GROUP_CONCAT(c.fullname ORDER BY c.id SEPARATOR ' | ') AS course_names
FROM mdl_course c
WHERE c.id <> 1
GROUP BY LEFT(REGEXP_REPLACE(LOWER(TRIM(c.fullname)), '[^a-z0-9]', ''), 4)
HAVING COUNT(*) > 1
ORDER BY total_courses DESC, first_4_normalized_chars;
This helps find courses that may have naming convention differences.
Example:
DevOps Basics
DevOps Basic Course
DevOps Basics 2025
Part 7: Migration Plan from Course Meta Link to Cohort Sync
If your Moodle site currently uses Course meta links but you want to move to Cohort sync, use this plan.
Step 1: Audit Existing Meta Links
Run:
SELECT
e.id AS enrol_instance_id,
target.id AS target_course_id,
target.fullname AS target_course_name,
source.id AS source_course_id,
source.fullname AS source_course_name
FROM mdl_enrol e
JOIN mdl_course target ON target.id = e.courseid
JOIN mdl_course source ON source.id = e.customint1
WHERE e.enrol = 'meta'
ORDER BY source.fullname, target.fullname;
Step 2: Create Replacement Cohort
Create:
OneMembership
Step 3: Add Existing Users to Cohort
Either manually add users or upload users using CSV:
username,cohort1
student1,OneMembership
student2,OneMembership
student3,OneMembership
Step 4: Add Cohort Sync to Target Courses
Use Upload courses CSV:
shortname,enrolment_1,enrolment_1_cohortidnumber,enrolment_1_role
COURSE001,cohort,OneMembership,student
COURSE002,cohort,OneMembership,student
COURSE003,cohort,OneMembership,student
Step 5: Verify Access
Check one student account:
User is in OneMembership cohort
User can access all required courses
Step 6: Remove Old Course Meta Links
After confirming Cohort sync is working, remove old Course meta link enrolment methods from the affected courses.
Do not delete source courses until you confirm no course still depends on them.
Part 8: Which One Should You Use?
Use Cohort Sync When:
You sell memberships
You manage corporate learners
You have batches of students
You want one group to access many courses
You want cleaner long-term access control
You want to bulk manage hundreds of courses
Use Course Meta Link When:
One course genuinely controls another course
A program course should unlock module courses
A parent course and child courses are intentionally connected
You want enrolment and role sync from one course to another
Avoid Course Meta Link When:
You only need membership-based course access
You are using a dummy/master course just as a user container
You plan to delete or frequently modify source courses
You have hundreds of courses and need simple access control
Final Architecture Recommendation
For a Moodle business, training company, certification platform, or membership portal, the clean structure is:
Users
↓
Cohort: OneMembership
↓
Cohort Sync
↓
Courses
For example:
OneMembership
├── DevOps Foundation
├── Docker Masterclass
├── Kubernetes Advanced
├── Jenkins CI/CD
├── Terraform on AWS
└── SRE Foundation
This gives you one central access point. Add user once, remove user once, and Moodle handles access through Cohort sync.
Course meta link is powerful, but use it only when courses are logically dependent on each other.
The simplest rule is:
For user groups, use Cohorts.
For course-to-course dependency, use Course meta link.
That one rule will save you many Moodle admin headaches.