Moodle User integration

Last updated on
29 January 2022

The Moodle User Integration module is a separate sub-module that needs to be enable in addition to the base Moodle Integration module.

Moodle System Configuration User Tab
Enabling the User Integration submodule adds 'User' configuration tab on Administration > Configuration > Web services > Moodle System Configuration

The configuration for the User integration has three sections

Associate

If the module should attempt to match Drupal users with Moodle users, and which field it should store the Moodle User ID in, if found. Permission to use the webservice function 'core_user_get_users_by_field' is needed to associate users.

The module will try and match the users by their email address. If you would like to match on another field see documentation on the associate event.

The User Integration module by default adds a Moodle ID field to the user and will store the ID in this. The field is set not to be displayed on the form or profile page by default. You can change to enable a link from the Drupal User profile page to the Moodle User profile page.

Push

If the module should push data from Drupal User fields to Moodle User fields, which fields and when. By default the module is enabled to push changes of email address if users have been associated.

Create new users in Moodle when they are created in Drupal is a special case as it requires that you must push data for the 'username', 'firstname', 'lastname' and 'email' Moodle fields.

Permission to use the webservice functions 'core_user_create_users', 'core_user_delete_users', 'core_user_update_users' are required as applicable.

Fields

The field mappings on the Drupal side use fully expanded 'Migrate' style field names. So 'mail/0/value' is the first value (and only as it is a single value field) of the mail field. Equally if you have a textfield 'field_first_name' you will probably want 'field_first_name/0/value'.

A field it is not possible to synchronize is the password field, as this is stored as a hash. For more discussion about integrating the login see the single sign on discussion .

Pull

If the module should pull data from Moodle User fields into Drupal User fields, which fields and when. By default the module is enabled to pull changes of email address.

The field mappings are in the same format as Push, but can be simpler in that for single fields you don't need to specify the '/0/value' part.

Permission to use the webservice function 'core_user_get_users' is required for pulling individual user fields.

Help improve this page

Page status: No known problems

You can: