PulseLMS User and Cohort Management Guide¶
Complete Guide to Cohorts, User Groups, and Bulk Management¶
Document Version: 2.0 Last Updated: January 2026 Applies To: PulseLMS 4.x and later
Table of Contents¶
- Understanding Cohorts vs Groups
- Creating Site-Wide Cohorts
- Category-Level Cohorts
- Bulk User Upload to Cohorts
- Cohort Sync Enrollment Method
- Automatic Cohort Assignment
- Profile-Based Cohort Membership
- Managing Cohort Members
- Cohort Role Synchronization
- CSV Upload Formats
- Cohort Best Practices
- Troubleshooting Cohort Issues
- Advanced Cohort Management
- Cohort Reporting
- Integration with External Systems
- Appendix: Quick Reference
Understanding Cohorts vs Groups¶
What are Cohorts?¶
Cohorts are site-wide or category-level collections of users that simplify enrollment and user management in PulseLMS. Think of cohorts as organizational containers that can be used to:
- Enroll multiple users into courses simultaneously
- Apply policies or restrictions to specific user populations
- Organize users by department, location, job role, or any other criteria
- Streamline administrative tasks for large user bases
What are Groups?¶
Groups are course-level collections of users that facilitate collaboration and content segregation within a specific course. Groups allow:
- Team-based activities and assignments
- Discussion forums limited to group members
- Separate gradebooks for different sections
- Activity restrictions based on group membership
Key Differences¶
| Feature | Cohorts | Groups |
|---|---|---|
| Scope | Site-wide or category level | Course level only |
| Purpose | Enrollment and user management | Course activity and collaboration |
| Created by | Site/category administrators | Course teachers/managers |
| Visibility | Administrative (hidden from users) | Visible to course participants |
| Enrollment | Can sync to multiple courses | N/A (already enrolled) |
| Persistence | Exists across all courses | Specific to one course |
| Nesting | Can be hierarchical | Flat structure |
Visual Comparison¶
COHORT (Site-Wide) GROUP (Course-Level)
┌─────────────────────────────────┐ ┌─────────────────────────────────┐
│ Engineering Team │ │ Course: INTRO101 │
│ ┌───────────────────────────┐ │ │ ┌────────────────────────────┐ │
│ │ John Smith │ │ │ │ Group A: Morning Section │ │
│ │ Mary Johnson │ │ │ │ - John Smith │ │
│ │ Tom Williams │ │ │ │ - Sarah Brown │ │
│ │ Sarah Brown │ │ │ └────────────────────────────┘ │
│ │ David Lee │ │ │ │
│ └───────────────────────────┘ │ │ ┌────────────────────────────┐ │
│ │ │ │ Group B: Afternoon Section│ │
│ ↓ Syncs to multiple courses │ │ │ - Mary Johnson │ │
│ - Engineering Orientation │ │ │ - Tom Williams │ │
│ - Safety Training │ │ │ - David Lee │ │
│ - Professional Development │ │ └────────────────────────────┘ │
└─────────────────────────────────┘ └─────────────────────────────────┘
When to Use Cohorts¶
Use cohorts when you need to:
| Scenario | Why Cohorts Work Best |
|---|---|
| Onboard new employees | Add to cohort once, automatically enrolled in all required courses |
| Department-based training | Sync department cohort to relevant courses |
| Annual compliance training | Enroll entire organization via cohort |
| Program management | Group students by program and enroll in curriculum |
| Regional organization | Manage users by geographic location |
| Role-based access | Assign different roles based on cohort membership |
When to Use Groups¶
Use groups when you need to:
| Scenario | Why Groups Work Best |
|---|---|
| Team projects | Students collaborate in small teams |
| Discussion sections | Separate forum discussions for different sections |
| Lab sections | Different instructors for different sections |
| Assessment groups | Group-based assignments and submissions |
| Peer review | Limit peer review to group members |
| Scheduling | Different deadlines for different groups |
Cohorts and Groups Together¶
Cohorts and groups can work together effectively:
Workflow: Cohorts + Groups Integration
┌────────────────────────────────────────────────────────────────┐
│ 1. Create cohorts by department │
│ - Engineering Cohort │
│ - Marketing Cohort │
│ │
│ 2. Sync cohorts to course enrollment │
│ - All engineers enrolled via cohort sync │
│ - All marketers enrolled via cohort sync │
│ │
│ 3. Create groups within course based on cohorts │
│ - "Engineering Group" populated from cohort │
│ - "Marketing Group" populated from cohort │
│ │
│ 4. Apply group restrictions to activities │
│ - Engineering-specific resources │
│ - Marketing-specific resources │
└────────────────────────────────────────────────────────────────┘
Creating Site-Wide Cohorts¶
Overview¶
Site-wide cohorts (also called system cohorts) are available across all courses in your PulseLMS instance. They are managed by site administrators and can be used for enrollment in any course on the platform.
Accessing Cohort Management¶
Navigate to: Site Administration > Users > Accounts > Cohorts
Step-by-Step Cohort Creation¶
Step 1: Access the Cohort Creation Page¶
- Navigate to Site Administration > Users > Accounts > Cohorts
- Click the Add new cohort button
- The cohort creation form will appear
Step 2: Configure Cohort Settings¶
Fill in the following fields:
| Field | Description | Required | Best Practice |
|---|---|---|---|
| Name | Display name for the cohort | Yes | Use descriptive, consistent naming |
| Context | Where the cohort is available | Yes | Select "System" for site-wide |
| Cohort ID | Unique identifier for external systems | No | Use for integrations/CSV uploads |
| Description | Purpose and membership criteria | No | Document who belongs and why |
| Visible | Whether cohort appears in lists | No | Enable for selection in courses |
| Component | How the cohort is managed | Auto | Typically empty for manual cohorts |
| Theme | Associated theme (if applicable) | No | Rarely used |
Step 3: Save the Cohort¶
- Review all entered information
- Click Save changes
- The cohort will appear in the cohort list
- You can now add members to the cohort
Cohort Naming Conventions¶
Establish consistent naming conventions for cohorts:
Recommended Naming Patterns:
┌────────────────────────────────────────────────────────────────┐
│ Pattern: [Category]_[Descriptor]_[Year/Version] │
│ │
│ Examples: │
│ DEPT_Engineering_2024 │
│ DEPT_Marketing_2024 │
│ ROLE_Managers_All │
│ ROLE_NewHires_Q1_2024 │
│ PROG_MBA_Cohort2024 │
│ LOC_NewYork_Office │
│ TEMP_ConferenceAttendees_March2024 │
│ │
│ Prefixes: │
│ DEPT_ = Department-based │
│ ROLE_ = Role/position-based │
│ PROG_ = Academic program │
│ LOC_ = Location-based │
│ TEMP_ = Temporary/event-based │
└────────────────────────────────────────────────────────────────┘
Cohort ID Best Practices¶
The Cohort ID field enables integration with external systems:
| Use Case | ID Format Example | Purpose |
|---|---|---|
| HR Integration | HR_DEPT_001 | Match HR department codes |
| Student System | SIS_PROG_MBA2024 | Match student information system |
| CSV Uploads | eng_team_2024 | Simple reference for bulk operations |
| API Access | api_cohort_12345 | Programmatic access |
Site-Wide Cohort Examples¶
Example 1: Department Cohort¶
Name: Engineering Department
Context: System
Cohort ID: DEPT_ENG
Description: All employees in the Engineering department.
Automatically enrolled in:
- Engineering Orientation
- Technical Skills Development
- Safety Training
Visible: Yes
Example 2: New Employee Cohort¶
Name: 2024 Q1 New Hires
Context: System
Cohort ID: NEWHIRE_2024Q1
Description: Employees who started between Jan 1 - Mar 31, 2024.
Enrolled in onboarding curriculum.
Remove after 90 days.
Visible: Yes
Example 3: Compliance Training Cohort¶
Name: Annual Compliance - All Staff
Context: System
Cohort ID: COMPLY_ANNUAL_ALL
Description: All active employees for annual compliance training.
Used for: Ethics, Security, Harassment Prevention
Refreshed annually in January.
Visible: Yes
Managing Multiple Cohorts¶
For organizations with many cohorts, consider:
- Cohort Categories: Use naming prefixes to categorize
- Regular Reviews: Audit cohorts quarterly
- Archive Old Cohorts: Rename with ARCHIVE_ prefix instead of deleting
- Document Purpose: Maintain spreadsheet of all cohorts and their purposes
Category-Level Cohorts¶
Understanding Category Cohorts¶
Category-level cohorts are available only within a specific course category and its sub-categories. They provide a middle ground between site-wide and course-level organization.
Use Cases for Category Cohorts¶
| Use Case | Description |
|---|---|
| Academic Departments | Cohorts for specific academic divisions |
| Business Units | Separate training cohorts per business unit |
| Client Organizations | Separate cohorts for different client companies |
| Training Programs | Program-specific cohorts within training category |
| Regional Offices | Location-specific cohorts within regional category |
Creating Category-Level Cohorts¶
Method 1: From Site Administration¶
- Navigate to Site Administration > Users > Accounts > Cohorts
- Click Add new cohort
- In the Context dropdown, select the desired category
- Complete the remaining fields
- Click Save changes
Method 2: From Category Management¶
- Navigate to Site Administration > Courses > Manage courses and categories
- Select the target category
- Click on Cohorts in the category menu
- Click Add new cohort
- The context is automatically set to the current category
- Complete the fields and save
Category Cohort Hierarchy¶
Course Category Structure with Cohorts:
┌────────────────────────────────────────────────────────────────┐
│ Top Level: All Courses │
│ └── System Cohorts (available everywhere) │
│ │
│ Category: Professional Development │
│ ├── Category Cohorts: │
│ │ ├── PD_Managers (available in PD and subcategories) │
│ │ └── PD_Executives (available in PD and subcategories) │
│ │ │
│ ├── Sub-category: Leadership Training │
│ │ ├── Inherits: PD_Managers, PD_Executives │
│ │ └── Local Cohorts: │
│ │ └── LEAD_Cohort2024 │
│ │ │
│ └── Sub-category: Technical Skills │
│ ├── Inherits: PD_Managers, PD_Executives │
│ └── Local Cohorts: │
│ └── TECH_Developers │
└────────────────────────────────────────────────────────────────┘
Category Cohort vs Site-Wide Cohort¶
| Aspect | Site-Wide Cohort | Category Cohort |
|---|---|---|
| Availability | All courses | Category and sub-categories only |
| Management | Site administrators | Category managers or above |
| Visibility | Entire site | Category context only |
| Use case | Organization-wide | Department/division specific |
| Scalability | Single source of truth | Delegated management |
Delegated Cohort Management¶
Category managers can manage cohorts within their categories:
Permission Structure for Category Cohort Management:
┌────────────────────────────────────────────────────────────────┐
│ Site Administrator: │
│ ✓ Create/edit/delete all cohorts │
│ ✓ View all cohort memberships │
│ ✓ Sync cohorts to any course │
│ │
│ Category Manager (Engineering Category): │
│ ✓ Create/edit/delete cohorts in Engineering category │
│ ✓ View cohort memberships in managed category │
│ ✓ Sync cohorts to courses in managed category │
│ ✗ Cannot access cohorts outside managed category │
│ │
│ Course Manager: │
│ ✗ Cannot create/edit cohorts │
│ ✓ Can use existing cohorts for enrollment │
│ ✓ Can view cohort members in their courses │
└────────────────────────────────────────────────────────────────┘
Bulk User Upload to Cohorts¶
Overview¶
Bulk upload allows you to add multiple users to cohorts simultaneously using CSV files. This is essential for:
- Initial cohort population
- Periodic membership updates
- Integration with HR systems
- Mass enrollment scenarios
CSV Format for Cohort Assignment¶
Option 1: During User Creation¶
Add cohort assignments when creating new users:
username,firstname,lastname,email,cohort1,cohort2,cohort3
jsmith,John,Smith,[email protected],Engineering,NewHires2024,AllEmployees
mjohnson,Mary,Johnson,[email protected],Marketing,NewHires2024,AllEmployees
twilliams,Tom,Williams,[email protected],Engineering,NewHires2024,AllEmployees
Option 2: Cohort-Only Update File¶
Update cohort memberships for existing users:
username,cohort1,cohort2
jsmith,Engineering,ProjectAlpha
mjohnson,Marketing,ProjectBeta
twilliams,Engineering,ProjectAlpha
Using Cohort Names vs IDs¶
You can reference cohorts by either name or ID number:
| Reference Method | CSV Value | Notes |
|---|---|---|
| By Name | Engineering | Must match exactly (case-sensitive) |
| By ID | ENG_DEPT_001 | Uses the Cohort ID field |
| By Internal ID | 12345 | Uses database ID (not recommended) |
Step-by-Step Bulk Upload Process¶
Step 1: Prepare Your CSV File¶
- Create a CSV file with required columns
- Include cohort assignments as
cohort1,cohort2, etc. - Verify cohort names/IDs match existing cohorts
- Save as UTF-8 encoded CSV
Step 2: Navigate to Upload Users¶
- Go to Site Administration > Users > Accounts > Upload users
- Click Choose a file or drag your CSV
- Set the CSV delimiter and encoding
Step 3: Configure Cohort Settings¶
In the upload settings, locate the Cohort section:
Cohort Upload Settings:
┌────────────────────────────────────────────────────────────────┐
│ Cohort column: │
│ [x] Map cohort1 column │
│ [x] Map cohort2 column │
│ [x] Map cohort3 column │
│ │
│ Cohort ID type: │
│ ○ Name (matches cohort name exactly) │
│ ● ID number (matches cohort ID field) │
│ │
│ Create cohorts if missing: │
│ ○ No (skip if cohort doesn't exist) │
│ ● Yes (create new cohorts as needed) │
│ │
│ Context for new cohorts: │
│ [ System ▼ ] │
└────────────────────────────────────────────────────────────────┘
Step 4: Preview and Execute¶
- Review the preview to verify cohort assignments
- Check for any errors or warnings
- Click Upload users
- Review the results report
Bulk Cohort Management Tool¶
For managing cohort memberships without the full user upload:
Navigate to: Site Administration > Users > Accounts > Cohort sync
Upload Format for Cohort Sync¶
action,cohort_id,username
add,ENG_DEPT,jsmith
add,ENG_DEPT,mjohnson
add,MKT_DEPT,twilliams
remove,OLD_COHORT,jsmith
remove,OLD_COHORT,mjohnson
| Column | Description | Values |
|---|---|---|
| action | Operation to perform | add, remove |
| cohort_id | Cohort identifier | Name or ID |
| username | Target user | Username |
Handling Large Uploads¶
For very large cohort assignments (1000+ users):
Large Upload Best Practices:
┌────────────────────────────────────────────────────────────────┐
│ 1. Split into batches of 500-1000 users │
│ 2. Schedule during off-peak hours │
│ 3. Monitor server resources during upload │
│ 4. Keep backup of original data │
│ 5. Test with small sample first │
│ 6. Document the upload process │
│ 7. Verify results after each batch │
└────────────────────────────────────────────────────────────────┘
Automated Cohort Upload via CLI¶
For scheduled or scripted uploads:
# Upload users with cohort assignments
php admin/cli/uploaduser.php \
--file=/path/to/users.csv \
--delimiter=comma \
--encoding=UTF-8 \
--updatepassword=0 \
--createpassword=1 \
--cohortid=name
# Example scheduled task (crontab)
0 2 * * * php /var/www/html/pulselms/admin/cli/uploaduser.php --file=/data/nightly_users.csv
Cohort Sync Enrollment Method¶
Understanding Cohort Sync¶
Cohort sync is an enrollment method that automatically enrolls all members of a cohort into a course. When users are added to or removed from the cohort, their course enrollment is automatically updated.
Benefits of Cohort Sync¶
| Benefit | Description |
|---|---|
| Automatic enrollment | No manual enrollment needed |
| Synchronized | Changes reflect immediately |
| Scalable | Handles any number of users |
| Consistent | Same enrollment across courses |
| Auditable | Clear enrollment source |
| Reversible | Remove cohort sync to disenroll all |
Enabling Cohort Sync¶
Site-Level Configuration¶
- Navigate to Site Administration > Plugins > Enrolments > Manage enrol plugins
- Ensure Cohort sync has an eye icon (enabled)
- Click the settings icon to configure defaults
Default Settings¶
| Setting | Description | Recommended |
|---|---|---|
| Add instance to new courses | Auto-add cohort sync option | No (manual control) |
| Enable by default | New instances enabled by default | Yes |
| Default role | Role assigned to enrolled users | Student |
| Course welcome message | Send welcome email | Course default |
Adding Cohort Sync to a Course¶
Step 1: Navigate to Course Enrollment¶
- Enter the course
- Go to Course administration > Users > Enrolment methods
- Or navigate via Participants > Enrol users > Enrolment methods
Step 2: Add Cohort Sync Method¶
- From the Add method dropdown, select Cohort sync
- The configuration form appears
Step 3: Configure Cohort Sync¶
| Setting | Description | Options |
|---|---|---|
| Cohort | Select the cohort to sync | Available cohorts list |
| Role | Role for enrolled users | Student, Teacher, etc. |
| Add to group | Optionally add to course group | None or select group |
| Create new group | Create group from cohort | Yes/No |
| Enrolment start | When enrollment begins | Optional date |
| Enrolment end | When enrollment ends | Optional date |
Step 4: Save and Verify¶
- Click Add method
- Verify cohort members appear in participants list
- Check user roles are correct
Cohort Sync Configuration Examples¶
Example 1: Department Training¶
Course: Engineering Onboarding
Cohort: Engineering Department
Role: Student
Add to group: Engineering Team (create if needed)
Start date: Not set (immediate)
End date: Not set (ongoing)
Example 2: Instructor Enrollment¶
Course: Fundamentals of Training
Cohort: All Instructors
Role: Non-editing teacher
Add to group: None
Start date: Not set
End date: Not set
Example 3: Time-Limited Training¶
Course: Q1 2024 Compliance
Cohort: All Active Employees
Role: Student
Add to group: None
Start date: January 1, 2024
End date: March 31, 2024
Multiple Cohort Sync Instances¶
A course can have multiple cohort sync instances for different purposes:
Course: Company-Wide Training
┌────────────────────────────────────────────────────────────────┐
│ Enrollment Methods: │
│ │
│ 1. Cohort Sync: All Employees → Role: Student │
│ - All employees enrolled as learners │
│ │
│ 2. Cohort Sync: Training Team → Role: Non-editing Teacher │
│ - Training team enrolled as facilitators │
│ │
│ 3. Cohort Sync: Managers → Role: Student │
│ Group: Manager Discussion │
│ - Managers enrolled with separate group │
│ │
│ 4. Cohort Sync: Executives → Role: Guest │
│ - Executives can view but not participate │
└────────────────────────────────────────────────────────────────┘
Cohort Sync with Groups¶
Combine cohort sync with course groups for powerful organization:
Cohort-to-Group Mapping:
┌────────────────────────────────────────────────────────────────┐
│ Course: Advanced Project Management │
│ │
│ Cohort Sync 1: │
│ Cohort: NYC_Office │
│ Role: Student │
│ Create group: NYC Team │
│ │
│ Cohort Sync 2: │
│ Cohort: LA_Office │
│ Role: Student │
│ Create group: LA Team │
│ │
│ Cohort Sync 3: │
│ Cohort: Remote_Workers │
│ Role: Student │
│ Create group: Remote Team │
│ │
│ Result: Three groups with location-based membership │
└────────────────────────────────────────────────────────────────┘
Removing Cohort Sync¶
To remove a cohort sync enrollment:
- Navigate to Course > Enrolment methods
- Find the cohort sync instance
- Click the Delete icon
- Confirm removal
Important: Removing cohort sync will disenroll all users who were enrolled through that method.
Cohort Sync vs Manual Enrollment¶
| Aspect | Cohort Sync | Manual Enrollment |
|---|---|---|
| Initial setup | One-time configuration | Per-user enrollment |
| Ongoing maintenance | Automatic | Manual updates |
| User addition | Via cohort | Via enrollment |
| User removal | Via cohort | Manual unenrollment |
| Audit trail | Cohort membership | Individual records |
| Flexibility | All-or-nothing per cohort | Individual control |
Automatic Cohort Assignment¶
Overview¶
Automatic cohort assignment rules can add users to cohorts based on their profile attributes, eliminating manual cohort management. This is particularly useful for:
- Departmental organization
- Regional grouping
- Role-based cohorts
- Attribute-based segmentation
Enabling Automatic Assignment¶
Navigate to: Site Administration > Users > Accounts > Cohorts
Plugin Configuration¶
First, ensure the automatic cohort assignment capability is enabled:
- Navigate to Site Administration > Plugins > Admin tools > Cohort roles sync (if available)
- Or use profile field-based assignment rules
Profile Field Triggers¶
Configure cohorts to automatically accept users based on profile field values:
Automatic Assignment Rules:
┌────────────────────────────────────────────────────────────────┐
│ Rule 1: Department Field │
│ When: profile_field_department = "Engineering" │
│ Add to: Engineering Cohort │
│ │
│ Rule 2: Location Field │
│ When: city = "New York" │
│ Add to: NYC Office Cohort │
│ │
│ Rule 3: Custom Field │
│ When: profile_field_job_level = "Manager" │
│ Add to: Managers Cohort │
│ │
│ Rule 4: Institution Field │
│ When: institution = "Acme Corp" │
│ Add to: Acme Corporation Cohort │
└────────────────────────────────────────────────────────────────┘
Creating Assignment Rules¶
Step 1: Identify Trigger Field¶
Determine which profile field will trigger cohort assignment:
| Field Type | Examples | Notes |
|---|---|---|
| Standard fields | department, institution, city | Built-in fields |
| Custom dropdown | profile_field_division | Custom profile field |
| Custom text | profile_field_employee_type | Custom profile field |
Step 2: Create the Cohort¶
Ensure the target cohort exists with appropriate settings:
Cohort for Auto-Assignment:
Name: Sales Department
Context: System
Cohort ID: AUTO_SALES_DEPT
Description: Automatically populated based on department field.
Members added when department = "Sales"
Do not manually add members.
Component: (Leave blank for manual trigger)
Step 3: Configure Assignment Rule¶
Using the profile-based assignment tool (if available via plugin):
- Navigate to the cohort configuration
- Click Add rule or Automatic membership
- Select the trigger field
- Set the trigger condition
- Save the rule
Event-Based Assignment¶
Cohort assignments can be triggered by events:
| Event | Trigger | Result |
|---|---|---|
| User creation | Profile matches criteria | Added to cohort |
| Profile update | Field value changes | Added/removed from cohort |
| User sync | External system update | Cohort membership updated |
| Scheduled task | Daily/hourly check | Bulk membership update |
Scheduled Task Configuration¶
Configure automatic assignment to run on schedule:
Navigate to: Site Administration > Server > Scheduled tasks
Find: Automatic cohort membership sync
Scheduled Task Configuration:
┌────────────────────────────────────────────────────────────────┐
│ Task: \core\task\cohort_sync_task │
│ │
│ Schedule: │
│ Minute: 0 │
│ Hour: * (every hour) or 2 (daily at 2 AM) │
│ Day: * │
│ Month: * │
│ Day of week: * │
│ │
│ Last run: 2024-03-15 02:00:05 │
│ Next run: 2024-03-16 02:00:00 │
│ Status: Enabled │
└────────────────────────────────────────────────────────────────┘
Custom Assignment Logic¶
For complex assignment rules, use webhooks or custom development:
// Example: Custom cohort assignment based on multiple criteria
// This would be implemented as a local plugin
function local_customcohort_assign_user($user) {
global $DB;
// Get user's custom profile fields
$department = get_user_profile_field($user->id, 'department');
$location = get_user_profile_field($user->id, 'location');
$seniority = get_user_profile_field($user->id, 'years_employed');
// Determine appropriate cohorts
$cohorts = [];
// Department cohort
if ($department) {
$cohorts[] = 'DEPT_' . strtoupper($department);
}
// Location cohort
if ($location) {
$cohorts[] = 'LOC_' . strtoupper($location);
}
// Seniority-based cohort
if ($seniority >= 5) {
$cohorts[] = 'SENIOR_EMPLOYEES';
} else {
$cohorts[] = 'JUNIOR_EMPLOYEES';
}
// Add user to cohorts
foreach ($cohorts as $cohort_idnumber) {
$cohort = $DB->get_record('cohort', ['idnumber' => $cohort_idnumber]);
if ($cohort) {
cohort_add_member($cohort->id, $user->id);
}
}
}
Profile-Based Cohort Membership¶
Overview¶
Profile-based cohort membership allows dynamic cohort population based on user profile attributes. This creates "smart" cohorts that automatically maintain correct membership.
Types of Profile-Based Rules¶
| Rule Type | Description | Example |
|---|---|---|
| Exact Match | Field equals specific value | department = "Engineering" |
| Contains | Field contains text | email contains "@company.com" |
| Starts With | Field begins with text | username starts with "student" |
| Date Range | Date field within range | hire_date > 2023-01-01 |
| Numeric | Numeric comparison | years_experience >= 5 |
| Multi-Value | Field in list of values | country IN (US, CA, MX) |
Setting Up Profile-Based Membership¶
Step 1: Identify Profile Fields¶
Review available profile fields for cohort criteria:
Standard Fields: - username, firstname, lastname, email - city, country, institution, department - firstaccess, lastaccess
Custom Profile Fields: - profile_field_* (any custom field)
Step 2: Create Rule Sets¶
Define the logic for cohort membership:
Profile-Based Cohort Rule Example:
┌────────────────────────────────────────────────────────────────┐
│ Cohort: Active US Managers │
│ │
│ Include users where ALL of the following are true: │
│ ├── country = "US" │
│ ├── profile_field_job_level = "Manager" │
│ ├── suspended = 0 │
│ └── deleted = 0 │
│ │
│ Exclude users where ANY of the following are true: │
│ ├── profile_field_contractor = "Yes" │
│ └── lastaccess < (now - 180 days) │
└────────────────────────────────────────────────────────────────┘
Common Profile-Based Cohort Scenarios¶
Scenario 1: Geographic Cohorts¶
Rule: North America Region Cohort
┌────────────────────────────────────────────────────────────────┐
│ Condition: country IN ("US", "CA", "MX") │
│ Members: All users from USA, Canada, Mexico │
│ │
│ Result: │
│ - Automatically includes new users from these countries │
│ - Removes users who change country to non-NA │
│ - Updates when profile is modified │
└────────────────────────────────────────────────────────────────┘
Scenario 2: Job Function Cohorts¶
Rule: Engineering Department Cohort
┌────────────────────────────────────────────────────────────────┐
│ Condition: profile_field_department = "Engineering" │
│ OR profile_field_department = "IT" │
│ OR profile_field_department = "DevOps" │
│ │
│ Members: All tech-related department members │
│ │
│ Result: │
│ - Includes all engineering, IT, DevOps staff │
│ - Updates when user changes department │
│ - Enables tech-focused training enrollment │
└────────────────────────────────────────────────────────────────┘
Scenario 3: Tenure-Based Cohorts¶
Rule: New Hire Cohort (First 90 Days)
┌────────────────────────────────────────────────────────────────┐
│ Condition: profile_field_hire_date >= (today - 90 days) │
│ │
│ Members: All employees hired in the last 90 days │
│ │
│ Result: │
│ - New hires automatically added on creation │
│ - Automatically removed after 90 days │
│ - Enables onboarding curriculum enrollment │
└────────────────────────────────────────────────────────────────┘
Dynamic vs Static Cohorts¶
| Aspect | Dynamic (Profile-Based) | Static (Manual) |
|---|---|---|
| Membership | Auto-calculated | Manually maintained |
| Updates | Real-time or scheduled | Manual only |
| Accuracy | Always current | May drift over time |
| Maintenance | Low effort | High effort |
| Flexibility | Rule-based | Individual control |
| Auditability | Rule is documentation | Need separate records |
Combining Multiple Rules¶
Create complex cohorts with AND/OR logic:
Complex Rule Cohort: Senior Remote Workers
┌────────────────────────────────────────────────────────────────┐
│ Rules (AND logic - all must be true): │
│ │
│ Rule Group 1: Experience Level │
│ ├── profile_field_years_employed >= 5 │
│ OR │
│ └── profile_field_job_level IN ("Senior", "Lead", "Manager")│
│ │
│ AND │
│ │
│ Rule Group 2: Work Location │
│ └── profile_field_work_location = "Remote" │
│ │
│ AND │
│ │
│ Rule Group 3: Active Status │
│ ├── suspended = 0 │
│ └── deleted = 0 │
│ │
│ Result: Cohort of experienced remote workers │
└────────────────────────────────────────────────────────────────┘
Managing Cohort Members¶
Viewing Cohort Membership¶
Navigate to: Site Administration > Users > Accounts > Cohorts
- Find the target cohort in the list
- Click the Assign icon (user icon with arrow)
- View current members and potential members
Member Management Interface¶
Cohort Membership Screen:
┌────────────────────────────────────────────────────────────────┐
│ Cohort: Engineering Department │
│ ID: DEPT_ENG | Members: 45 | Context: System │
├────────────────────────────────────────────────────────────────┤
│ │
│ Current Members (45) │ Potential Members (823) │
│ ┌─────────────────────────┐ │ ┌─────────────────────────┐│
│ │ ☐ John Smith │ │ │ ☐ Alice Anderson ││
│ │ ☐ Mary Johnson │◄──┼───│ ☐ Bob Baker ││
│ │ ☐ Tom Williams │ │ │ ☐ Carol Chen ││
│ │ ☐ Sarah Brown │ │ │ ☐ Dan Davis ││
│ │ ☐ David Lee │──►┼───│ ☐ Eve Edwards ││
│ │ ☐ ... │ │ │ ☐ ... ││
│ └─────────────────────────┘ │ └─────────────────────────┘│
│ [◄ Remove] │ [Add ►] │
│ │
│ Search: [___________________] │ Search: [___________________]│
│ │
└────────────────────────────────────────────────────────────────┘
Adding Members Individually¶
- Access the cohort membership screen
- Search for users in the "Potential Members" list
- Select one or more users
- Click Add button
- Users move to "Current Members"
Removing Members Individually¶
- Access the cohort membership screen
- Search for users in the "Current Members" list
- Select one or more users
- Click Remove button
- Users move back to "Potential Members"
Bulk Member Management¶
Adding Multiple Users via CSV¶
Create a CSV file for bulk cohort assignment:
username,cohort1
jsmith,Engineering
mjohnson,Engineering
twilliams,Engineering
sbrown,Engineering
dlee,Engineering
Upload via: Site Administration > Users > Accounts > Upload users - Select "Add new and update existing" - Cohort assignment will be processed
Removing Multiple Users via CSV¶
By providing empty cohort values during update, users can be removed from cohorts.
Member Search and Filtering¶
The cohort membership interface supports searching:
| Search Field | What It Matches |
|---|---|
| Name | First name, last name, full name |
| Email address | |
| Username | Login username |
| ID Number | User ID number field |
Cohort Membership Reports¶
Generate membership reports for audit and management:
Navigate to: Site Administration > Reports > Cohort participation (if available)
Or export via: 1. Access cohort membership screen 2. Use browser print or copy functionality 3. Export to spreadsheet for further analysis
Tracking Membership Changes¶
Cohort membership changes are logged:
Navigate to: Site Administration > Reports > Logs
Filter by: - Event name: "Member added to cohort" - Event name: "Member removed from cohort"
Sample Log Entries:
┌────────────────────────────────────────────────────────────────┐
│ Time │ User │ Event │ Cohort │
├────────────┼───────────────┼─────────────────────────┼────────┤
│ 10:15:32 │ Admin User │ Member added to cohort │ Eng │
│ 10:15:33 │ Admin User │ Member added to cohort │ Eng │
│ 10:15:34 │ Admin User │ Member added to cohort │ Eng │
│ 11:20:00 │ System │ Member removed (sync) │ Old │
│ 11:20:01 │ System │ Member removed (sync) │ Old │
└────────────────────────────────────────────────────────────────┘
Cohort Role Synchronization¶
Understanding Role Sync¶
Cohort role synchronization automatically assigns system roles to cohort members. This is separate from course enrollment roles - it applies site-wide or at category level.
Use Cases for Role Sync¶
| Use Case | Cohort | Role |
|---|---|---|
| Course creators | Training Developers | Course Creator |
| Managers with permissions | Department Managers | Manager |
| Staff access | All Staff | Authenticated User (enhanced) |
| Support team | Help Desk Team | Course Supporter |
Enabling Cohort Role Sync¶
Navigate to: Site Administration > Users > Accounts > Cohort roles sync
Or configure per-cohort: 1. Go to cohort settings 2. Look for role sync options 3. Select roles to assign
Role Sync Configuration¶
Cohort Role Sync Setup:
┌────────────────────────────────────────────────────────────────┐
│ Cohort: Training Developers │
│ │
│ Synchronize role: │
│ [x] Course Creator - can create courses in specified context │
│ [ ] Manager - has management capabilities │
│ [ ] Non-editing Teacher │
│ │
│ Context: │
│ ○ System (site-wide) │
│ ● Category: Professional Development │
│ │
│ Sync behavior: │
│ [x] Add role when user joins cohort │
│ [x] Remove role when user leaves cohort │
└────────────────────────────────────────────────────────────────┘
Role Sync Examples¶
Example 1: Department Course Creators¶
Configuration:
Cohort: L&D Team
Role: Course Creator
Context: Category - All Training Courses
Result:
All L&D Team members can create courses
in the Training Courses category
Example 2: Manager Dashboard Access¶
Configuration:
Cohort: Department Managers
Role: Manager
Context: System
Result:
All managers have site-wide manager role
Can view reports, manage users in scope
Multi-Role Sync¶
A cohort can sync multiple roles:
Multi-Role Cohort Configuration:
┌────────────────────────────────────────────────────────────────┐
│ Cohort: Senior Training Staff │
│ │
│ Synchronized Roles: │
│ 1. Course Creator (System) │
│ - Can create courses anywhere │
│ │
│ 2. Manager (Category: Training Programs) │
│ - Can manage courses in Training Programs │
│ │
│ 3. Custom Role: Report Viewer (System) │
│ - Can access advanced reporting │
│ │
│ Members receive ALL synchronized roles │
└────────────────────────────────────────────────────────────────┘
Role Sync vs Course Enrollment Roles¶
| Aspect | Role Sync | Course Enrollment Role |
|---|---|---|
| Scope | Site/Category | Specific course |
| Assignment | Via cohort | Via enrollment method |
| Capabilities | System-level | Course-level |
| Examples | Course Creator, Manager | Student, Teacher |
CSV Upload Formats¶
User Upload with Cohort Assignment¶
Basic Format¶
username,firstname,lastname,email,cohort1
jsmith,John,Smith,[email protected],Engineering
mjohnson,Mary,Johnson,[email protected],Marketing
twilliams,Tom,Williams,[email protected],Engineering
Extended Format with Multiple Cohorts¶
username,firstname,lastname,email,cohort1,cohort2,cohort3
jsmith,John,Smith,[email protected],Engineering,NewHires,AllStaff
mjohnson,Mary,Johnson,[email protected],Marketing,NewHires,AllStaff
twilliams,Tom,Williams,[email protected],Engineering,Remote,AllStaff
Complete User CSV Template¶
username,password,firstname,lastname,email,city,country,institution,department,phone1,idnumber,cohort1,cohort2,course1,role1,group1,profile_field_hire_date,profile_field_job_level
jsmith,TempPass123!,John,Smith,[email protected],Boston,US,Acme Corp,Engineering,555-0101,EMP001,Engineering,AllStaff,ONBOARD101,student,Team A,2024-01-15,Junior
mjohnson,TempPass456!,Mary,Johnson,[email protected],Chicago,US,Acme Corp,Marketing,555-0102,EMP002,Marketing,AllStaff,ONBOARD101,student,Team B,2024-01-20,Senior
twilliams,TempPass789!,Tom,Williams,[email protected],Seattle,US,Acme Corp,Engineering,555-0103,EMP003,Engineering,Remote,ONBOARD101,student,Team A,2024-02-01,Mid
Cohort Management CSV¶
For updating cohort memberships only:
username,cohort1,cohort2,cohort3
jsmith,Engineering,ProjectAlpha,
mjohnson,Marketing,ProjectBeta,Executives
twilliams,Engineering,ProjectAlpha,Remote
sbrown,HR,AllStaff,
Cohort-Only CSV (for dedicated cohort sync tools)¶
action,cohort,username
add,Engineering,jsmith
add,Engineering,twilliams
add,Marketing,mjohnson
add,AllStaff,jsmith
add,AllStaff,mjohnson
add,AllStaff,twilliams
remove,OldProject,jsmith
remove,OldProject,mjohnson
CSV Field Reference¶
| Column | Required | Description | Example Values |
|---|---|---|---|
| username | Yes | Unique login ID | jsmith |
| password | Conditional | Initial password | TempPass123! |
| firstname | Yes | Given name | John |
| lastname | Yes | Family name | Smith |
| Yes | Email address | [email protected] | |
| cohort1 | No | First cohort | Engineering |
| cohort2 | No | Second cohort | AllStaff |
| cohort3 | No | Third cohort | Remote |
| course1 | No | Course shortname | ONBOARD101 |
| role1 | No | Role in course1 | student |
| group1 | No | Group in course1 | Team A |
| profile_field_* | No | Custom field | Any value |
CSV Encoding Requirements¶
CSV File Requirements:
┌────────────────────────────────────────────────────────────────┐
│ Encoding: UTF-8 (required for international characters) │
│ │
│ Line endings: Unix (LF) or Windows (CRLF) │
│ │
│ Delimiter options: │
│ - Comma (,) - default │
│ - Semicolon (;) - common in European locales │
│ - Tab (\t) - for data with commas │
│ │
│ Text qualifier: Double quotes (") for fields with delimiters │
│ │
│ Example with quotes: │
│ jsmith,"Smith, Jr.",John,[email protected] │
│ │
│ Header row: Required (first row contains column names) │
└────────────────────────────────────────────────────────────────┘
Sample CSV Files¶
New Employee Onboarding¶
username,password,firstname,lastname,email,institution,department,profile_field_hire_date,profile_field_manager,cohort1,cohort2,course1,role1
ajones,Welcome2024!,Alice,Jones,[email protected],Company Inc,Sales,2024-03-01,Bob Smith,Sales,NewHires2024,ONBOARD001,student
bwilson,Welcome2024!,Bob,Wilson,[email protected],Company Inc,Engineering,2024-03-01,Carol Davis,Engineering,NewHires2024,ONBOARD001,student
cmartin,Welcome2024!,Carol,Martin,[email protected],Company Inc,Marketing,2024-03-01,Dan Brown,Marketing,NewHires2024,ONBOARD001,student
Department Transfer Update¶
username,department,cohort1,cohort2
jsmith,Marketing,Marketing,AllStaff
mjohnson,Engineering,Engineering,AllStaff
Termination Processing¶
username,suspended,deleted,cohort1,cohort2
former_employee1,1,0,,
former_employee2,1,0,,
terminated_user,0,1,,
Cohort Best Practices¶
Naming and Organization¶
Cohort Naming Convention¶
Establish a consistent naming scheme:
Recommended Naming Structure:
[TYPE]_[CATEGORY]_[SPECIFIC]_[VERSION/DATE]
Examples:
DEPT_ENG_SOFTWARE (Department: Engineering - Software Team)
DEPT_MKT_DIGITAL (Department: Marketing - Digital Team)
ROLE_MGR_ALL (Role: All Managers)
ROLE_EXEC_SENIOR (Role: Senior Executives)
PROG_MBA_2024 (Program: MBA Class of 2024)
PROJ_ALPHA_TEAM (Project: Alpha Project Team)
LOC_US_EAST (Location: US East Coast)
TEMP_CONF_SPRING2024 (Temporary: Spring 2024 Conference)
Cohort Documentation¶
Maintain a cohort registry:
| Cohort ID | Name | Purpose | Owner | Created | Review Date |
|---|---|---|---|---|---|
| DEPT_ENG | Engineering | All engineering staff | IT Manager | 2023-01 | 2024-07 |
| ROLE_MGR | Managers | All people managers | HR | 2023-01 | 2024-07 |
| PROG_ONBOARD | Onboarding | Active new hires | L&D | 2024-01 | 2024-04 |
Lifecycle Management¶
Cohort Lifecycle Best Practices:
┌────────────────────────────────────────────────────────────────┐
│ CREATION │
│ □ Define clear purpose and membership criteria │
│ □ Choose appropriate context (system vs category) │
│ □ Use meaningful name and ID │
│ □ Document in cohort registry │
│ │
│ MAINTENANCE │
│ □ Regular membership audits (quarterly) │
│ □ Remove inactive/departed members promptly │
│ □ Update documentation when purpose changes │
│ □ Review cohort sync enrollments │
│ │
│ ARCHIVAL │
│ □ Don't delete - rename with ARCHIVE_ prefix │
│ □ Remove from all cohort sync enrollments │
│ □ Document archival date and reason │
│ □ Keep for compliance/audit purposes │
│ │
│ DELETION │
│ □ Verify no active cohort syncs │
│ □ Confirm no dependencies │
│ □ Get approval from cohort owner │
│ □ Document deletion for compliance │
└────────────────────────────────────────────────────────────────┘
Security Considerations¶
| Practice | Description | Implementation |
|---|---|---|
| Least privilege | Limit cohort management access | Assign minimal necessary permissions |
| Audit logging | Track all cohort changes | Enable and review logs regularly |
| Separation of duties | Different people create vs assign | Split administrative responsibilities |
| Regular review | Audit memberships periodically | Quarterly cohort reviews |
| Documentation | Record all cohort purposes | Maintain cohort registry |
Performance Optimization¶
For large cohorts (1000+ members):
Performance Best Practices:
┌────────────────────────────────────────────────────────────────┐
│ 1. BULK OPERATIONS │
│ - Use CSV upload for large membership changes │
│ - Schedule during off-peak hours │
│ - Process in batches if needed │
│ │
│ 2. COHORT SYNC TIMING │
│ - Don't sync very large cohorts to many courses │
│ - Consider course-specific cohorts │
│ - Monitor scheduled task performance │
│ │
│ 3. DATABASE CONSIDERATIONS │
│ - Ensure proper database indexing │
│ - Monitor query performance │
│ - Archive old cohort data │
│ │
│ 4. CACHING │
│ - Enable cohort membership caching │
│ - Set appropriate cache TTL │
│ - Clear cache after major changes │
└────────────────────────────────────────────────────────────────┘
Common Mistakes to Avoid¶
| Mistake | Impact | Prevention |
|---|---|---|
| Vague cohort names | Confusion, misuse | Use clear naming convention |
| No documentation | Knowledge loss | Maintain cohort registry |
| Orphaned cohorts | Clutter, confusion | Regular cleanup |
| Over-nesting | Complexity | Keep hierarchy flat |
| No owner assigned | Lack of maintenance | Assign ownership |
| Infrequent audits | Stale membership | Schedule regular reviews |
| Deleting instead of archiving | Lost history | Archive old cohorts |
Troubleshooting Cohort Issues¶
Common Problems and Solutions¶
Problem: Users Not Appearing in Cohort¶
Diagnosis Steps:
┌────────────────────────────────────────────────────────────────┐
│ 1. Verify user exists and is not suspended/deleted │
│ → Check: Site Admin > Users > Browse list of users │
│ │
│ 2. Check if user was already added │
│ → Check: Cohort > Assign > Current members │
│ │
│ 3. Verify cohort visibility/context │
│ → Check: Cohort settings > Context and visibility │
│ │
│ 4. Check for duplicate cohorts with similar names │
│ → Check: Search cohorts for similar names │
│ │
│ 5. Review upload logs for errors │
│ → Check: Upload results page or system logs │
└────────────────────────────────────────────────────────────────┘
Problem: Cohort Sync Not Enrolling Users¶
Diagnosis Steps:
┌────────────────────────────────────────────────────────────────┐
│ 1. Verify cohort sync is enabled in course │
│ → Check: Course > Enrolment methods > Cohort sync status │
│ │
│ 2. Verify correct cohort is selected │
│ → Check: Cohort sync settings > Cohort field │
│ │
│ 3. Check if enrollment dates are current │
│ → Check: Cohort sync settings > Start/end dates │
│ │
│ 4. Verify cohort sync plugin is enabled site-wide │
│ → Check: Site Admin > Plugins > Enrolments > Manage │
│ │
│ 5. Run cron/scheduled tasks │
│ → Check: Site Admin > Server > Scheduled tasks │
│ │
│ 6. Check enrollment capability │
│ → Verify role allows enrollment in the course │
└────────────────────────────────────────────────────────────────┘
Problem: Bulk Upload Fails¶
| Error Message | Cause | Solution |
|---|---|---|
| "Cohort not found" | Cohort doesn't exist | Create cohort first or check spelling |
| "Invalid cohort" | Wrong context | Use system cohort or correct category |
| "Duplicate username" | User already exists | Use update mode in upload settings |
| "Invalid email" | Email format wrong | Fix email format in CSV |
| "Required field missing" | Empty required column | Fill in all required fields |
| "Encoding error" | Wrong file encoding | Save as UTF-8 |
Problem: Users Can't Be Removed from Cohort¶
Possible Causes and Solutions:
┌────────────────────────────────────────────────────────────────┐
│ Cause 1: Component-managed cohort │
│ - Cohort is managed by external system (LDAP, HR sync) │
│ - Solution: Remove via managing system │
│ │
│ Cause 2: Automatic membership rules │
│ - User's profile still matches rule criteria │
│ - Solution: Update user's profile to not match rules │
│ │
│ Cause 3: Permission issue │
│ - Admin doesn't have cohort management permission │
│ - Solution: Check admin role capabilities │
│ │
│ Cause 4: Cached membership │
│ - Old data in cache │
│ - Solution: Purge caches and refresh │
└────────────────────────────────────────────────────────────────┘
Diagnostic Queries¶
For administrators with database access:
-- Find all cohorts for a user
SELECT c.name, c.idnumber, c.description
FROM cohort c
JOIN cohort_members cm ON c.id = cm.cohortid
JOIN user u ON cm.userid = u.id
WHERE u.username = 'jsmith';
-- Find all members of a cohort
SELECT u.username, u.firstname, u.lastname, u.email
FROM user u
JOIN cohort_members cm ON u.id = cm.userid
JOIN cohort c ON cm.cohortid = c.id
WHERE c.idnumber = 'DEPT_ENG';
-- Check cohort sync enrollments
SELECT c.shortname as course, co.name as cohort, e.status
FROM enrol e
JOIN course c ON e.courseid = c.id
JOIN cohort co ON e.customint1 = co.id
WHERE e.enrol = 'cohort';
Log Analysis¶
Key log entries to look for:
| Log Event | Indicates |
|---|---|
| "Member added to cohort" | Successful addition |
| "Member removed from cohort" | Successful removal |
| "Cohort sync enrolment" | Sync-based enrollment |
| "Error adding cohort member" | Failed addition |
| "Cohort not found" | Missing cohort reference |
Getting Support¶
If issues persist:
- Check documentation: Review relevant sections
- Verify permissions: Ensure admin has proper capabilities
- Test isolation: Try with single user/cohort
- Enable debugging: Increase log verbosity
- Contact support: Provide specific error details
Advanced Cohort Management¶
Hierarchical Cohorts¶
Create cohort hierarchies for complex organizations:
Hierarchical Cohort Structure:
┌────────────────────────────────────────────────────────────────┐
│ Level 1: Organization │
│ ALL_EMPLOYEES │
│ │
│ Level 2: Division │
│ ├── DIV_TECHNOLOGY │
│ ├── DIV_OPERATIONS │
│ └── DIV_CORPORATE │
│ │
│ Level 3: Department │
│ ├── DEPT_ENGINEERING (child of DIV_TECHNOLOGY) │
│ ├── DEPT_IT_SUPPORT (child of DIV_TECHNOLOGY) │
│ ├── DEPT_MANUFACTURING (child of DIV_OPERATIONS) │
│ ├── DEPT_LOGISTICS (child of DIV_OPERATIONS) │
│ ├── DEPT_HR (child of DIV_CORPORATE) │
│ └── DEPT_FINANCE (child of DIV_CORPORATE) │
│ │
│ Level 4: Team │
│ ├── TEAM_FRONTEND (child of DEPT_ENGINEERING) │
│ ├── TEAM_BACKEND (child of DEPT_ENGINEERING) │
│ └── TEAM_QA (child of DEPT_ENGINEERING) │
└────────────────────────────────────────────────────────────────┘
Cohort Membership Rules Engine¶
Advanced rule-based membership:
Rule Engine Configuration:
┌────────────────────────────────────────────────────────────────┐
│ Cohort: High-Priority Compliance Training │
│ │
│ Rule Set (OR logic - any rule triggers membership): │
│ │
│ Rule 1: Access Level │
│ IF profile_field_access_level IN ("Confidential", "Secret") │
│ THEN add to cohort │
│ │
│ Rule 2: Job Function │
│ IF profile_field_job_function = "Financial" │
│ AND country = "US" │
│ THEN add to cohort │
│ │
│ Rule 3: Manual Override │
│ IF profile_field_compliance_required = "Yes" │
│ THEN add to cohort │
│ │
│ Exclusion Rule: │
│ IF profile_field_employee_type = "Contractor" │
│ THEN exclude from cohort │
└────────────────────────────────────────────────────────────────┘
API-Based Cohort Management¶
For programmatic cohort management:
// Example: Add user to cohort via API/Plugin
require_once('path/to/config.php');
require_once($CFG->dirroot . '/cohort/lib.php');
// Get cohort by idnumber
$cohort = $DB->get_record('cohort', ['idnumber' => 'DEPT_ENG']);
// Get user
$user = $DB->get_record('user', ['username' => 'jsmith']);
// Add user to cohort
if (!cohort_is_member($cohort->id, $user->id)) {
cohort_add_member($cohort->id, $user->id);
}
// Remove user from cohort
cohort_remove_member($cohort->id, $user->id);
// Get all cohort members
$members = $DB->get_records_sql("
SELECT u.*
FROM {user} u
JOIN {cohort_members} cm ON cm.userid = u.id
WHERE cm.cohortid = ?
", [$cohort->id]);
Web Services for Cohort Management¶
Available web service functions:
| Function | Description |
|---|---|
core_cohort_create_cohorts |
Create new cohorts |
core_cohort_delete_cohorts |
Delete cohorts |
core_cohort_get_cohorts |
Retrieve cohort info |
core_cohort_update_cohorts |
Update cohort settings |
core_cohort_add_cohort_members |
Add members |
core_cohort_delete_cohort_members |
Remove members |
core_cohort_get_cohort_members |
List members |
Cohort Reporting¶
Built-in Reports¶
Cohort Membership Report¶
Navigate to: Site Administration > Reports > Cohorts (if available)
Report fields: - Cohort name and ID - Member count - Member list with details - Course enrollment summary
Enrollment by Cohort Report¶
Navigate to: Course > Reports > Enrolment or create custom report
Sample Report Output:
┌────────────────────────────────────────────────────────────────┐
│ Course: Annual Compliance Training │
│ Report Date: 2024-03-15 │
│ │
│ Cohort │ Members │ Enrolled │ Completed │ Rate │
│ ──────────────────│─────────│──────────│───────────│─────────│
│ Engineering │ 45 │ 45 │ 38 │ 84% │
│ Marketing │ 28 │ 28 │ 25 │ 89% │
│ Sales │ 52 │ 52 │ 41 │ 79% │
│ HR │ 12 │ 12 │ 12 │ 100% │
│ Finance │ 18 │ 18 │ 16 │ 89% │
│ ──────────────────│─────────│──────────│───────────│─────────│
│ TOTAL │ 155 │ 155 │ 132 │ 85% │
└────────────────────────────────────────────────────────────────┘
Custom Report Builder¶
Create custom cohort reports:
- Navigate to Site Administration > Reports > Report builder
- Create new report
- Select "Users" or "Cohorts" as source
- Add relevant columns:
- User fields
- Cohort membership
- Course completion
- Grades
Scheduled Report Delivery¶
Configure automatic report delivery:
Scheduled Report Configuration:
┌────────────────────────────────────────────────────────────────┐
│ Report: Weekly Cohort Enrollment Summary │
│ │
│ Schedule: │
│ Frequency: Weekly │
│ Day: Monday │
│ Time: 07:00 │
│ │
│ Recipients: │
│ - [email protected] │
│ - [email protected] │
│ │
│ Format: PDF │
│ │
│ Content: │
│ [x] Cohort membership summary │
│ [x] New members this week │
│ [x] Removed members this week │
│ [x] Enrollment status by course │
└────────────────────────────────────────────────────────────────┘
Integration with External Systems¶
HR System Integration¶
Automatic User Import with Cohorts¶
HR Integration Flow:
┌────────────────────────────────────────────────────────────────┐
│ HR System ──────> Integration Layer ──────> PulseLMS │
│ │
│ Data Flow: │
│ 1. HR system exports employee data nightly │
│ 2. Integration maps departments to cohorts │
│ 3. Users created/updated in PulseLMS │
│ 4. Cohort memberships synchronized │
│ 5. Course enrollments cascade via cohort sync │
│ │
│ Mapping Example: │
│ HR Department "Engineering" → Cohort "DEPT_ENG" │
│ HR Department "Marketing" → Cohort "DEPT_MKT" │
│ HR Status "Active" → Not suspended │
│ HR Status "Terminated" → Suspended │
└────────────────────────────────────────────────────────────────┘
LDAP/Active Directory Integration¶
Configure cohort synchronization with AD groups:
LDAP-Cohort Mapping:
┌────────────────────────────────────────────────────────────────┐
│ AD Group: CN=Engineers,OU=Groups,DC=company,DC=com │
│ ↓ │
│ PulseLMS Cohort: LDAP_Engineers │
│ │
│ AD Group: CN=Managers,OU=Groups,DC=company,DC=com │
│ ↓ │
│ PulseLMS Cohort: LDAP_Managers │
│ │
│ Sync Schedule: Every 4 hours │
│ Sync Mode: Add and remove (full sync) │
└────────────────────────────────────────────────────────────────┘
Student Information System (SIS) Integration¶
SIS Integration Example:
┌────────────────────────────────────────────────────────────────┐
│ SIS Program: MBA-2024 │
│ ↓ │
│ PulseLMS Cohort: PROG_MBA_2024 │
│ ↓ │
│ Cohort Sync Courses: │
│ - MBA Core Curriculum │
│ - Business Statistics │
│ - Organizational Behavior │
│ - Financial Management │
│ │
│ Enrollment Effect: │
│ Student enrolled in SIS → Added to cohort → │
│ Automatically enrolled in all program courses │
└────────────────────────────────────────────────────────────────┘
Webhook Integration¶
Configure webhooks for cohort events:
{
"webhook_config": {
"url": "https://integration.company.com/pulselms/webhook",
"events": [
"cohort_member_added",
"cohort_member_removed",
"cohort_created",
"cohort_deleted"
],
"payload": {
"cohort_id": "{{cohort.idnumber}}",
"cohort_name": "{{cohort.name}}",
"user_id": "{{user.idnumber}}",
"user_email": "{{user.email}}",
"action": "{{event.type}}",
"timestamp": "{{event.time}}"
}
}
}
Appendix: Quick Reference¶
Cohort Management Quick Reference¶
| Task | Navigation |
|---|---|
| View all cohorts | Site Admin > Users > Accounts > Cohorts |
| Create cohort | Cohorts > Add new cohort |
| Add members | Cohorts > Assign (user icon) |
| Bulk upload | Site Admin > Users > Upload users |
| Enable cohort sync | Course > Enrolment methods > Add > Cohort sync |
| View enrollment | Course > Participants |
CSV Column Quick Reference¶
| Column | Purpose | Required |
|---|---|---|
| username | User identifier | Yes |
| cohort1 | First cohort assignment | No |
| cohort2 | Second cohort assignment | No |
| cohort3 | Third cohort assignment | No |
Cohort vs Group Comparison¶
| Feature | Cohorts | Groups |
|---|---|---|
| Scope | Site/Category | Course |
| Enrollment | Yes | No |
| Activities | No | Yes |
| Multi-course | Yes | No |
| Admin only | Yes | No |
Permission Quick Reference¶
| Capability | Description |
|---|---|
| moodle/cohort:view | View cohorts |
| moodle/cohort:manage | Create/edit/delete cohorts |
| moodle/cohort:assign | Add/remove members |
Troubleshooting Checklist¶
Before contacting support:
□ Verified user exists and is active
□ Checked cohort spelling/ID
□ Confirmed cohort context is appropriate
□ Tested with single user
□ Reviewed upload error messages
□ Checked cohort sync enrollment settings
□ Ran scheduled tasks manually
□ Cleared caches
□ Reviewed system logs
Document History¶
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0 | 2023-06-15 | Admin Team | Initial document |
| 1.5 | 2024-01-20 | Admin Team | Added integration section |
| 2.0 | 2026-01-03 | Admin Team | Major update, added troubleshooting and best practices |
This document is part of the PulseLMS Administrator Documentation Series.
For the latest version, visit: Site Administration > Documentation
Copyright 2024-2026 PulseLMS. All rights reserved.