Skip to content

Installation Moodle Side

netw3rker edited this page Dec 2, 2014 · 16 revisions

The following instructions describe how to setup Moodle so that it can connect to Drupal.

In this example Drupal is installed at http://localhost and Moodle is installed at http://moodle.localhost/.

Requirements

Versions are listed for reference only as these were the versions when this documentation was created.

  • Moodle 2.x+
  • moodle-drupalservices auth plugin.
  • Drupal services setup and working. Refer to Installation Drupal side.

Install moodle-drupalservices auth plugin.

Download and extract moodle-drupalservices into the auth/ directory. Change the extracted directory to drupalservices so that the directory structure looks something like:

auth/drupalservices/:
auth.php
lang
REST-API.php
README.md

In Moodle goto Site administration -> Plugins -> Authentication -> Manage authentication

You should see Drupal Services listed as an available plugin. Click on the Settings for Drupal Services.

Configure Drupal Services plugin.

The 2.x-2.x version of Drupal Services will automatically try to reach your Drupal site and configure the plugin for it. If the Drupal site can't be automatically detected, you'll be prompted for a single field:

  • Drupal URL (note: if you don't use clean urls, add an index.php?q= to the end of the url)
  • force login - this has been a common request from the community. Checking this will force all users to be logged in within all of Moodle. It will also make the SSO process smoother since users will not have to click "login" to magically be logged in.

Once this is supplied, you'll be ask to map profile fields in Moodle to their counterparts in Drupal. The important ones are:

  • firstname
  • lastname
  • city
  • country

The remainder should be filled in only if needed.

Finally you'll need to set up the user synchronization process. In order for the Drupalservices plugin to do this, you'll have to supply the username and password of the user you created earlier in Drupal.

  • Remote user
  • Remote user password

Save changes. When you visit the configuration page again, the system will attempt to connect to the Drupal installation in order to verify the configuration settings provided. You will see a series of Success / Fail messages with instructions to follow if you have an invalid setting. Please follow those instructions. If all of the items say success, you can then run the sync script below.

Enable the Drupal services plugin.

TESTING

  • Logout of moodle
  • Login to Drupal, then go to Moodle and see if you are logged in automatically.
  • Your account should be created if not already in Moodle.
  • Logout and see if you logged out from Drupal as well.
  • If all goes well, you can set alternateloginurl under Manage authentication to point to the drupal login page.
  • e.g. http://localhost/user/login. This means that drupal will do all logins.