Actions20
- User Actions
- Course Actions
- Enrollment Actions
- Grade Actions
- Message Actions
Overview
This node integrates with the Moodle Learning Management System (LMS) to manage user enrollments in courses. Specifically, the Unenroll User operation removes a specified user from a specified course enrollment.
Typical use cases include:
- Automatically unenrolling users from courses when they no longer need access.
- Managing course rosters dynamically based on external triggers or workflows.
- Cleaning up enrollments for users who have completed or dropped out of courses.
For example, an educational institution could use this node to automate unenrollment of students who have graduated or withdrawn, ensuring their course access is revoked promptly.
Properties
Name | Meaning |
---|---|
User ID | The unique identifier of the user to be unenrolled from the course. |
Course ID | The unique identifier of the course from which the user will be unenrolled. |
Output
The output JSON contains the response from the Moodle API after attempting to unenroll the user. Typically, this will be an object indicating success or failure of the unenrollment request.
Example output structure:
{
"success": true,
"message": "User [UserID] unenrolled successfully"
}
If the Moodle API returns no content (null), the node outputs a generic success message confirming the unenrollment.
No binary data is produced by this operation.
Dependencies
- Requires a valid connection to a Moodle instance with web service API enabled.
- Needs an API key credential configured in n8n for authenticating requests to Moodle.
- The Moodle web service must support the
enrol_manual_unenrol_users
function. - Proper permissions are required for the API user to manage enrollments.
Troubleshooting
Common issues:
- Invalid User ID or Course ID: Ensure the IDs exist and are correct.
- Insufficient permissions: The API user must have rights to manage enrollments.
- Moodle API not enabled or misconfigured: Verify that web services and the manual enrolment plugin are active.
Error messages:
- Errors returned from the Moodle API will be surfaced as node errors.
- If the node fails due to permission or parameter issues, check the error message for details.
- If the node throws an error about missing web service functions, confirm that the Moodle version supports manual unenrollment via API.
Resolution tips:
- Double-check user and course IDs in Moodle.
- Confirm API credentials and permissions.
- Test the API call directly using Moodle's REST client or similar tools.
- Enable detailed logging in Moodle to diagnose API call failures.
Links and References
- Moodle Web Services API documentation: https://docs.moodle.org/dev/Web_services
- Manual Enrolment Plugin: https://docs.moodle.org/311/en/Manual_enrolment
- Moodle API function
enrol_manual_unenrol_users
: https://docs.moodle.org/dev/Core_enrol_manual#Web_service_functions