Moodle HR and student information system integration

How to sync users, cohorts and enrolments from an HR or student information system into self-hosted Moodle, send grades and completions back, and verify the result before go-live.

On this page

Why Moodle HR and student information system integration needs a source-of-truth decision

When an HR or student information system record drives who can sign in, which cohorts a person belongs to and what they are enrolled in, the integration work is less about moving data and more about deciding which system owns each attribute and how changes flow from that owner into Moodle. Before anyone writes a sync job, the team needs a written answer for each field: is the identity record authoritative in HR or the SIS, is the cohort membership derived from a department code or a program code, and is enrolment created by the sync or by a teacher. Without those answers, two systems will quietly disagree, and Moodle will reflect whichever one updated last.

The problems tend to appear in the edge cases. Duplicate identities occur when one person has a staff record and a student record, or when a returning learner gets a new employee or student number. Late data arrives after term start, so a learner is missing from a course on day one. Leavers need a defined rule for suspension versus removal, and cross-term enrolments raise questions about when old enrolments end and whether grades and completions stay visible. Grade return rules add another layer: which grade is pushed back, at what point in the term, and who can override it in the source system. Each of these needs a test case before build starts.

Moodle core already ships several authentication options, including manual accounts, external database, LDAP, web services and LTI. Identity and enrolment are separate decisions, though. An authentication plugin decides how a user signs in, while an enrolment plugin decides which courses that user can access and with which role. A site can authenticate through one source and enrol from another, and the reader should confirm which combination the platform version and plugin set support before committing. Document the owner, direction and trigger for each attribute in one table, and review it with the registrar or HR team.

Which Moodle components carry the sync

An HR or student information system sync touches four layers in Moodle: how accounts are created, how users are enrolled into courses, how web services expose data, and how grades and completions return to the source system. Most of these pieces ship in core, but the exact behavior for each option depends on the Moodle release you run, so confirm the details against that release before you design the flow.

Account authentication plugins

The authentication plugin decides where a user account comes from and how a login is checked. Core ships external database, LDAP, OAuth 2 and web services authentication, and each can create or update accounts from a source record. Check which plugin matches your system of record, which field is the stable username, and whether accounts that leave the source are suspended in Moodle or left active.

Core auth plugins

Enrolment plugins for course access

Enrolment plugins control which users reach which courses. The database enrolment plugin reads enrolment records from an external table, the cohort plugin enrols members of a cohort, and manual and self enrolment cover staff-driven and learner-driven cases. Pick one primary source of truth per course so two plugins do not fight over the same role assignment when a user changes department or program.

Cohorts and groups

Cohorts are site-level or category-level collections of users that other features use for enrolment, reporting and targeting. Groups sit inside a course and organize participants for activities. Sync jobs usually build cohorts from HR departments or student cohorts, then drive enrolments from them. Confirm how your sync tool names cohorts so re-runs update existing cohorts instead of creating duplicates.

Web services and tokens

The web services layer exposes Moodle functions over an API that an external system can call, authenticated with tokens issued to a dedicated service user. Scope each token to the functions the sync needs, and treat the service account as privileged. Record which Moodle functions your integration calls, because a Moodle upgrade can change or deprecate them and the integration then needs testing before the release goes live.

Scheduled tasks and imports

Scheduled tasks run the sync on a timer through Moodle's cron, and some imports run as ad hoc tasks triggered by an event. The cron must run reliably for these jobs to complete, and a failed run should be logged and alerted rather than silently skipped. Confirm the schedule, the time zone, and how long a full reconciliation takes against your user count before you commit to a nightly window.

Gradebook and completion return flow

Grades and course completion data flow back to the source system through web services or a scheduled export. Completion tracking must be enabled per course and per activity before the data exists to send, and grade items need stable identifiers that match records in the student information system. Test the return path with a sample course because a mismatched identifier can write grades to the wrong student record without raising an error.

Choosing between enrolment plugins, web services and scheduled imports

Direct reads let Moodle pull records from the source system's database, usually through the external database plugins in the core authentication plugins and enrolment options. Moodle queries a view or table you define and then creates, updates or suspends accounts and enrolments on each scheduled run. The pattern works only when the vendor grants read access to a stable database object, which many hosted HR and SIS products do not offer.

  • Creates and updates: Moodle compares query results with its own records on each run, so the query must return a stable unique key such as an employee or student ID.
  • Suspensions and deletions: Removal behavior depends on the enrolment and authentication settings you choose. Test a removed row in a sandbox before enabling it in production, because a faulty query can suspend a large group.
  • Who operates it: Your Moodle administrators and database team own the query, credentials and network path. The vendor's role is usually limited to providing a read-only account and documenting the schema.
  • Failure recovery: Confirm what happens to existing enrolments when a query fails or returns fewer rows than expected, and add a row-count threshold that stops the run.

Confirm whether the vendor provides a read-only replica or view, what network access it allows, and whether it announces schema changes before they take effect.

Decisions that set the integration design

This table compares the six decisions that shape a Moodle sync from an HR system or student information system, with the situations where each option fits and the ongoing cost of choosing it. Read each row as a question to settle with the registrar or HR owner before any connector is built. The main takeaway is that identity ownership and deprovisioning rules are hard to change later, so settle them first.

DecisionOption and when it fitsOperational cost of the choice
System of record for identity versus enrolmentHR or SIS owns the person record and Moodle owns only course activity, for example when staff training is the main use. Alternatively, the SIS owns both identity and enrolment, which suits academic programmes.Splitting ownership means two sources can disagree about the same account. Someone must own conflicts, and support tickets will land in Moodle even when the fault is upstream.
Push versus pull timingScheduled pull through a database or flat-file import suits a nightly batch where the source system cannot call out. Event-driven push through web services suits same-day changes such as withdrawals or new hires.Pull is simpler to audit but leaves a gap until the next run. Push needs error handling, retries and monitoring of the web service, and failures can go unnoticed without alerts.
Deprovisioning: suspend or deleteSuspend keeps accounts, enrolments and grades for records and appeals, and suits most education and regulated settings. Delete suits short-term contractors where personal data must be removed on a set schedule.Suspension keeps personal data in Moodle longer, so retention rules must be written down. Deletion is hard to reverse and can remove grade history that other systems still reference.
Cohort naming and ownershipUse a stable, source-derived cohort ID such as a code from the SIS, and let the sync own those cohorts. Manual cohorts suit ad hoc groups that staff manage directly.Free-text names break matching after renames. Cohorts with mixed ownership get overwritten by the sync, so the naming rule and owner must be documented and enforced.
Students with multiple programmesEnrol through one enrolment record per programme and course, so withdrawing from one programme does not remove access to another. Alternatively, a single primary cohort suits simple cases only.Multiple enrolment methods increase the logic the sync must test. Each combination of programme, course and role needs a test case, and mistakes surface as missing or extra access.
Where grade and completion data is written backWrite grades to the SIS or gradebook of record through a scheduled export, or send completion flags to HR for training compliance. Keep Moodle as the only record when no external system needs the data.Write-back needs agreed grade scales, timing and a reconciliation step. Each downstream consumer adds a support contract and a change process, and corrections after release need a defined procedure.

How to build the Moodle sync in order

This sequence moves accounts, cohorts, enrolments and results between your HR or student information system and Moodle in a fixed order, so each layer is verified before the next one depends on it. The result is a sync that can be reviewed, rerun and handed to the team that operates it.

  1. Export and profile the source data

    Pull a full extract from the HR or student information system into a staging area, not directly into Moodle. Profile the extract for duplicate people, missing mandatory fields, inconsistent date formats, inactive records and the codes used for departments, programmes and course sections. Your data owner and the platform administrator should sign off the profile together, because every later step inherits its gaps. The check is a written profile report with record counts by population (staff, students, contractors, leavers) and a list of data quality issues assigned to an owner.

  2. Define the matching identifier

    Choose one stable identifier that exists in the source system and will be written to Moodle as the external key, typically a staff or student number rather than an email address, which people change. Confirm that the identifier is unique, never reused after a person leaves, and present for every population you will sync. Decide how the Moodle username and the external key relate, and record the decision. The check is a test extract where every source record maps to exactly one identifier, with zero collisions.

  3. Map attributes to user and profile fields

    Create a mapping table that links each source attribute to a Moodle core user field (such as first name, last name, email, department, city) or to a custom profile field you create in Moodle for data that has no core equivalent, such as programme code or contract type. Agree transformations up front, for example trimming whitespace or normalizing department names to a controlled list. Review the mapping with the HR or registry team and with the people who will read the data in Moodle. The check is a signed mapping document and a test import of a small sample that shows each field populated as the table predicts.

  4. Build the account sync

    Implement the user creation and update job using the method your environment supports, such as a scheduled file import, the external database authentication plugin, or the Moodle web services API called from a middleware job. Run it first against a copy of the Moodle site, not production. Confirm that re-running the job updates existing accounts instead of creating duplicates, and that changed attributes propagate. The check is a reconciliation report comparing the count of active source records with the count of active Moodle accounts, and a list of any unmatched records with a reason for each.

  5. Build cohort and enrolment sync with role mapping

    Translate source groupings into Moodle cohorts and course enrolments, and map source roles such as teacher, student or department head to Moodle roles. Decide which enrolment method owns each relationship so that the sync does not remove enrolments made by teachers or other methods. Test the full cycle on a pilot set of courses and cohorts, including a change in a person's department and a change in their course. The check is a comparison of expected enrolments per course, computed from the source, against actual enrolments in Moodle, with every difference explained.

  6. Add suspension and leaver handling

    Define what happens when a person is suspended in the source, leaves, or returns. Decide whether Moodle accounts are suspended, enrolments are ended, or both, and how completion and grade records are retained for leavers. Set a rule for accounts that disappear from the extract without a formal leaver event, since a failed extract should not remove the whole population. Include a safeguard that stops the job when the extract is unexpectedly small. The check is a test run where a removed record, a returning record and a failed short extract each produce the expected result and an alert.

  7. Set up grade and completion return on a test course

    Before any live return, create a test course with a few enrolled test accounts and send grades and course completion status from Moodle to the source system using the export or web service method your registry accepts. Confirm which grade item and completion criteria are sent, how grade scales are converted, and how resubmitted or changed grades are handled. Have the registry or payroll owner confirm the receiving format. The check is a side-by-side comparison of Moodle gradebook and completion values against what arrived in the source for every test learner, with no unexplained differences, before you enable the job for real courses.

How data moves between the HR or SIS, Moodle and the gradebook

The flow starts in the HR or student information system, which is the authoritative source for people and enrolments. An extract or API layer, running inside the source network, publishes changes to Moodle, which then creates accounts, cohorts and enrolments. Grades and completions travel the return path, and the trust boundary sits at the Moodle host, where each hop uses its own credential. Check that every hop has a dedicated, least-privilege account, that deprovisioning flows through the same path, and that the Moodle side can reject malformed records without stopping the rest of the batch.

Data flow between the source system, Moodle and the return path, with the trust boundary marked.

What drives effort and cost in an HR or SIS sync

This table lists the factors that change how much build and run work an HR or student information system sync needs in Moodle, and what to do about each one. Read each row as a lever: the driver explains why effort rises, and the middle column shows how to keep it down before a quote is written.

DriverWhy it changes effortHow to keep it down
User and enrolment volumeLarge populations and frequent full-file runs increase job runtime, database load and the time needed for test runs.Send only changed records with delta feeds where the source supports them, and confirm expected daily and peak volumes before design.
Number of source systemsEach HR, SIS or identity source adds its own field mappings, credentials, schedules and failure modes to test.Name one authoritative source for each attribute, such as identity from HR and course enrolment from the SIS, and avoid overlapping feeds.
Quality of source identifiersMissing, duplicated or changing employee or student IDs cause mismatched accounts, orphaned enrolments and manual cleanup.Agree a stable, unique identifier with the data owner before build, and check for duplicates and reused IDs in a sample extract.
Number of enrolment rulesEach rule for cohorts, roles, categories, dates or program codes needs design, logic tests and documentation for later changes.Limit rules to what the business needs, prefer cohort membership driven by one attribute, and remove rules that duplicate existing groupings.
Grade and completion return complexityPassing grades or completions back to an HR or SIS system needs format agreements, mapping of grade scales and checks on partial or disputed results.Start with completion status only, define the grade scale and timing in writing, and add grade return in a later phase if needed.
Number of environmentsDevelopment, test and production each need working credentials, sample data and repeatable runs, and drift between them increases retest effort.Reuse one staging environment for all sync tests, refresh it from anonymized extracts, and keep configuration in version control.
Personal data and compliance needsStudent and staff records bring access, retention, logging and data transfer reviews that add design and evidence work.Map which fields are required, minimize the data copied into Moodle, document retention and deletion rules, and confirm the review scope with your privacy team early.
Error handling and support ownershipUnclear ownership of rejected records, failed jobs and alerts creates rework after go-live.Decide who receives job reports and who corrects source data before launch, and ask any provider to define that split in the scope.

How the sync changes by deployment model

On a single web and database node, the simplest pattern is a scheduled import job that runs from the same host as Moodle, reads an extract from the HR system or student information system (SIS), and applies enrolments, cohorts and user changes through Moodle's own APIs or the enrolment and authentication tooling. Because only one node runs Moodle code, there is no question of which server executes the job, and the job can be tested against a copy of the production database before it touches live data.

  • Scheduling: Use the system cron on the host to call a CLI script at a fixed interval, and confirm that Moodle's own cron is running so that ad hoc tasks do not queue up behind a long import.
  • Secrets: Store the source database or API credentials in a file readable only by the web server and job user, such as a protected environment file, and never inside the Moodle code tree.
  • Testing: Run the import against a staging copy with a sample extract, then compare counts of users, cohorts and enrolments before and after.
  • Failure handling: Write each run to a log, keep the previous extract, and make the job safe to rerun without duplicating enrolments.

Before go-live, confirm with your Moodle administrator which scheduling tool your hosting provider supports and how it restarts the job after a server reboot.

How to control access and secrets in the sync

The sync account, its web service token and the database credentials it uses together decide what an attacker or a mistake could change in Moodle. Each control below narrows one part of that exposure and should be reviewed against your site's role model before go-live.

Scope the sync service account

Create a dedicated user for the sync rather than reusing an administrator account. Give it only the capabilities needed to create or suspend users, manage cohorts and write enrolments in the courses in scope, assigned through a custom role at the right context level. Review that role against the site's role model, since a broad system-level grant is the most common way a sync account ends up able to change far more than intended.

Plugin types docs

Keep tokens and credentials out of code

Store the web service token and any external database password in the environment, a secrets manager or a root-only configuration file, not in the sync script, the repository or the Moodle config.php committed to version control. Rotate them on a schedule and after any staff change. Confirm where the sync job reads secrets at runtime and who can view them.

Restrict web service functions

Create a dedicated external service that exposes only the functions the sync calls, such as user creation, enrolment and cohort membership. Leave everything else disabled and confirm the service is not authorized for other users. Test the token against a function outside the list to confirm it is refused, and repeat this check after every Moodle upgrade.

Log role and enrolment changes

Enable and retain logs for role assignments, enrolment changes and user suspensions, and confirm that changes made by the sync account are attributable to that account in the logs. Forward these records to your central logging or SIEM where possible. Decide who reviews them and how often, because a sync that silently grants a role is only detectable if someone reads the trail.

Minimize personal data in extracts

Limit the fields in the HR or student information system export to those Moodle needs for account matching and enrolment, such as identifier, name, email and cohort or course codes. Keep import files in restricted storage, delete them after processing, and avoid writing full records into sync logs or job output. Ask your privacy team which retention period applies to these extracts.

Review sync access on a schedule

Treat the sync account, its token and its database user as privileged identities with a named owner. Review their roles, service memberships and secret age against the site's role model at each Moodle upgrade and at least when the source system changes. Document the review so that auditors can see who approved the access and when it was last checked.

How to test that the sync is correct and fails safely

The most important test is the one that proves a bad source file cannot empty your user base. Before go-live, run the sync against a copy of production-shaped data in a staging Moodle, then replay a partial export, such as a file with half the staff rows missing, and confirm the run halts before it suspends anyone. Pair this with a maximum change threshold: if a single run would suspend, delete or move more than an agreed share of active accounts, or more than an agreed count, the job stops, writes nothing further, and alerts a named Moodle administrator. The threshold value is a business decision you should set with HR or the registrar, not a number to copy from this page. Also test that a failed run leaves the previous state intact and that the next successful run resumes cleanly.

Work through the lifecycle cases as scripted scenarios with expected results written down in advance. Create a learner from a new source record and confirm the username and idnumber match the source key. Change a surname, a department and a cohort membership and confirm the update lands without creating a duplicate account. Remove a learner from the source and confirm the account is suspended, not deleted, and that enrolments end as your policy says. Re-enrol the same person and confirm the original account is reused rather than recreated. Move a cohort between two programmes and confirm the old enrolments are removed and the new ones appear. Feed two source records with the same identifier and confirm the sync rejects both and reports them, rather than merging them silently. Check how your chosen identity source and enrolment plugin handle each case, because the behavior differs by plugin and version.

Grade and completion return needs its own test. Create a dedicated test course, enrol a few synthetic learners, record grades and completions in the course, and run the outbound export to the test endpoint or file. Reconcile the output line by line against the Moodle gradebook and the completion report, checking totals, letter or percentage conversions, and learners who have no grade yet. Confirm that a rerun does not double-post and that a learner with a hidden or overridden grade behaves as the registrar expects. Keep the reconciliation report as evidence. Confirm with your integration owner and the data owner which fields are authoritative before you test, because a mismatch between systems is usually a mapping question, not a code bug.

What to monitor, back up and document after go-live

A sync that works on day one can drift silently as data changes, plugins update and Moodle moves to new releases. The cards below cover what to watch, what to protect before changes, and what to write down so the integration can be run and fixed by someone other than its builder.

Sync run results and error counts

Record the outcome of every scheduled import or web service call, including records created, updated, suspended and rejected. Set an alert on rejected records and on runs that do not complete, because a failed enrolment run often looks normal until a teacher reports missing students. Review the error log on a fixed schedule and track whether the same errors recur, which usually points to a mapping or source data problem rather than a one-off fault.

Reconciliation against the source system

Compare Moodle users, cohort memberships and course enrolments with the HR or student information system on a regular cycle. Count mismatches by type: accounts present only in Moodle, learners missing from a cohort, and enrolments that should have ended. Reconciliation catches the drift that run logs cannot show, such as a source field changed upstream that the sync still reads without error.

Database and moodledata backups before changes

Take a consistent database backup and a copy of moodledata before any schema change, mapping edit or bulk import rule change. Confirm that a restore works in a non-production environment, since an untested backup offers little protection. Keep the plugin and configuration state with the backup so a rollback restores the sync logic as well as the data.

Retesting on each supported Moodle version

Moodle ships major releases in April and October and minor point releases every two months, and LTS releases carry security support for longer. Retest sync code, custom web service functions and mapping plugins on every version the site runs, including minor releases, before applying them to production. Check the release notes for changes to enrolment, user or web service APIs and for PHP and database requirements that may affect the sync host.

Major release cycle
Six months
Moodle releases

Field mappings, rules and owners

Document every source field, the Moodle field it maps to, transformation rules such as username format or cohort naming, and the rule for suspending or deleting a user. Name an owner for each source system and for the sync itself, with a contact for HR or registry changes. Store this record in the same place as the code and update it with every change, so an administrator can trace a wrong enrolment to a specific rule.

Questions teams ask before building or hiring help for Moodle sync

How much effort does a Moodle HR or SIS sync take, and what moves it most?

Effort depends mainly on how many source systems feed Moodle, how clean the identifiers are, and how many enrolment rules the business needs. A single nightly file import from one HR export is far smaller than a sync that creates users, assigns cohorts, handles mid-term transfers and returns grades to a student information system. The main drivers are the number of data sources, the quality of the matching keys such as employee or student numbers, the number of enrolment and role rules, whether the sync runs in both directions, and how many edge cases such as leavers, rehires and cross-listed courses must be handled. Ask any partner to show how each driver changes its estimate and to list the rules it has counted.

Can our internal team build a Moodle sync without a partner?

Often yes, if the team already runs Moodle administration and has someone comfortable with PHP, web services or scheduled jobs. Moodle core includes several options, such as the external database authentication and enrolment routes, web services and scheduled tasks, so the build does not always need custom code. The harder questions are ownership after go-live: who fixes the job when a source export changes, who reviews a Moodle upgrade against the sync code, and who answers for a wrong enrolment at 2 a.m. during exam week. Confirm your team has time for build, testing and recurring support, not only the first release.

What does the HR or SIS owner need to provide for the sync?

The HR or SIS owner usually provides the source of truth and its rules. That means a documented export or API, a stable unique identifier per person, the definition of an active enrolment, the rules for leavers and transfers, and a named contact who can approve changes to the data format. They also need to agree who owns data quality failures. The Moodle administrator provides the target configuration: authentication method, role assignments, cohort and category structure, enrolment plugin settings, a test site with a copy of the current configuration, and access to the scheduled task logs. Agree these responsibilities in writing before build starts.

How long does testing take compared with the build?

Testing usually takes a meaningful share of the project, and it often runs longer than teams expect because it must cover edge cases, not only the happy path. Plan separate test rounds for new users, changed users, leavers, rehires, cohort moves, duplicate identifiers and failed source files. Also test a full re-run to confirm the sync is idempotent. Compare sync output against a manual sample from the source system. The ratio depends on how many rules exist and how much test data the source owner can supply, so ask any partner for its test plan and the number of test cycles it assumes before you compare quotes.

Is it safe to send grades and completions back from Moodle?

It can be safe if the design limits who can change what and proves each write. Moodle exposes grades and course completion through its own APIs and reports, so the usual approach is to read completion data from Moodle and push it to the student information system with a dedicated service account that has only the capabilities it needs. Risks include duplicate grade posts, writes to the wrong student record, overwriting a grade a teacher has changed, and grades released before a policy allows. Control this with stable identifiers, a dry run, a reconciliation report, logged writes and a rule about which system wins when both hold a value. Confirm the exact grade fields and the release rules with the registrar or academic owner before build.

What should a fixed-scope quote for a Moodle sync list?

A fixed-scope quote should list the work in terms the client can check. Include the source systems and their export or API method, the identifier mapping, each enrolment and role rule, the cohort and category logic, the direction of data flow, the grade or completion fields returned, and the error handling and alerting design. It should also list the test cycles, the environments used, the training and handover, and the support period after go-live. Ask what is excluded, such as source system changes, Moodle upgrades, or new rules added later, and how a change request is priced. Ask for the assumptions behind each line so you can compare two quotes on the same basis.

Which Moodle version should the sync target?

Target a Moodle version that is still in support for the whole life of the integration. Moodle 5.1 has general support until 5 October 2026 and security support until 19 April 2027, and Moodle 5.2 has security support until 4 October 2027, according to Moodle's releases page. Moodle 4.5 is a long-term support release with security support until 4 October 2027. Check the release notes for PHP and database requirements, because they change between versions. The sync code should also be checked against each upgrade, so confirm which version your site runs before you choose the integration method.

How DeployOpen works on this

DeployOpen plans, implements, documents and supports self-hosted Moodle inside your own infrastructure, including the HR and student information system connections that keep Moodle accounts, cohorts and enrolments current. The work follows a written scope, a tested build in a non-production environment, and a handover your administrators can run without us.

How we scope

  • Map which HR or SIS fields create accounts, cohorts, roles and enrolments, and which system owns each one.
  • Agree the sync method in writing: enrolment plugin, web service, or scheduled import file.
  • Define the grade and completion return path, including which Moodle records are written back and how often.

How we build

  • Configure the connection in a staging Moodle that mirrors your production version and database.
  • Test with sample records covering new hires, leavers, transfers, duplicates and missing fields.
  • Document field mappings, error handling and rollback steps alongside the code or configuration.

How we hand over

  • Deliver runbooks for scheduled tasks, logs, failure alerts and manual reruns for your administrators.
  • Walk your team through the mapping tables and the process for changing a field or cohort rule.
  • Provide the written test record so your security and compliance reviewers can check the integration.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer, including checks after Moodle releases.
  • Confirm with us how the integration will be reviewed when Moodle or the HR or SIS system changes version.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.