Drupal - Moodle Integration

I'm the current owner of a pair of Drupal modules which help integrate the Drupal content management framework with the Moodle learning management system. Drupal and Moodle are among the best open-source packages in their respective spaces, and are likewise both very popular.

The two Moodle modules are named moodle and moodlesso. Recently, I committed a new branch to the moodle module tagged 6.x-2.0. This branch is the start of a new direction I want to take with both modules.

Previous versions of the moodle module provided an iframe within which the Moodle site was displayed, and also allowed a form of Single Sign On (SSO). SSO was provided by using an HTTP GET request with the username and password loaded into the request parameters and configuring Moodle to use database authentication and giving Moodle access to the Drupal's users table in its database. This method was kind of hackish and also a security risk.

With the new moodle module branch, I am changing the focus of this module to be strictly data integration features. In fact, there is essentially nothing from the previous versions in the new version as far as code goes, and only the ability to have a menu link which takes a person to the Moodle site remains as a common feature.

The moodlesso module will become the focal point for any SSO capabilities. As originally coded, it used some unsupported session token capabilities. My plan is to try to add several different SSO methods to this module to allow the admin to choose the one which works best in his or her environment. Currently this module has no new code or releases, but I am hoping to have something useful here in the next few months.

To allow data integration, the moodle module requires a plugin in the Moodle side. Because the existing methods for accessing Moodle as a web service had a number of shortcomings and complexities I didn't want to work with, I wrote a new web service interface for my Drupal module to query. It uses a RESTful model for services, and for lack of a better name, it's called the Quick API. The code can be obtained from the Google code repository for the moment. Hopefully, the whole thing can be hosted in a better arrangement in the future.



Hello Chris,

I have installed the qapi in our Moodle set up and added the IP of our Drupal site to the Allowed client list. In Drupal 6.10 I installed the Moodle 6.x02.2-beta1 module. I have the link set to the Primary memu. Now, when someone clicks on this link, a new windows opens and they are sent to the Moodle Main page but they don't get logged in. Shouldn't the user be logged into the Moodle site after pressing this link? An I missing a step?



No automatic log in provided

The version 2 branch (i.e. 6.x-2.y... versus 6.x-1.y...) is completely rewritten. In the older version 1 branch, the Moodle module provided a GET URL username and password to Moodle, and Moodle could then use that against the Drupal database to authenticate. That was insecure, and also not the direction I wanted to take the module. In version 2, the authentication ("log in") functionality was removed completely.

There are other methods to make this happen. Having to only log in once (to Drupal) and then automatically be logged into another application (e.g. Moodle) is called Single Signon or SSO. I use OpenID to enable SSO from Drupal to Moodle on my sites. Drupal is the OpenID provider, using the openid_provider module, and Moodle is the OpenID client (or relying party), using the OpenID plugin for Moodle.

I plan to offer another SSO option in the moodle_sso module for Drupal, but haven't completed that project yet.


Thanks for the reply Chris. I'm looking forward to see how your method works as a SSO option.

Thanks again


How to track?

I'd be interested in keeping track of your efforts because it currently appears integrating Drupal and Moodle w/b the best choice for my project.

How can I receive notifications of updates etc?

Email and RSS from project page at drupal.org

On the Drupal project page at http://drupal.org/project/moodle there are a number of ways to track activity. You can select to be emailed, and there are a couple of places where there are RSS feeds available as well.

Question about integrating Moodle.

Admittedly, I am still very new to this concept. I understand the advantage of being able to fold Moodle into Drupal. How much will I need to know and do to accomplish this task. I have a site with Fantastico, from which I have installed a drupal and moodle site.

Will your module be a simple install? What will I need to know to take advantage of your contribution?

This is information is

This is information is available on the Drupal project page at http://drupal.org/project/moodle.

moodle-drupal integration

i want to integrate drupal6.x with moodle 1.9......... if u guys have any idea pls do reply... i saw ddrupal4.x and moodle 1.6 integration....

Is that apply to the current version too....

thanks in advance.... pls help me out...

Drupal 6 integration has been

Drupal 6 integration has been available since August, 2008.

No table to add new client in Quick API inside moodle

Hi Chris,

I installed this module according you stated into the installation criteria..

but at one place, when I try to add new client into the Moodle Quick API screen..

it prompt me the error message.. Unable to add new client

any idea. why I am getting this?

thanks in advance

This means there is some

This means there is some database error when my code tries to insert the new client record. I used all of the standard Moodle database handling routines to do this, so cannot say further what the problem might be other than the obvious database problems: missing table, wrong permissions, database server failure, etc.

Drupal 6.x with Moodle 1.9.x

Dear chris,

For a school assignment I'm trying to get single sign on working between drupal 6.x and Moodle 1.9.x.

But everything i tried didn't worked. The Moodle SSO plugin is only for Drupal 5.x. And when I tried installing the OpenID Plugin in Moodle my administration pages went fubar.

Can you please help me?

Best Regards,
Wessel T.

The only way I've been able

The only way I've been able to get SSO with Drupal 6 and Moodle is with OpenID, and that was a lot of work and debugging. But it did finally work.

If you visit http://drupal.org/project/moodlesso, I describe the method I used with OpenID, and the one line of code I had to change in the Moodle OpenID plugin to make it work.

Note that I did not write the Moodle OpenID plugin, so really can't help you with the problems it may have caused you. However, the author of it seems to be fairly responsive, so you might try contacting him.

Hey Chris I've setup 2 sites

Hey Chris

I've setup 2 sites now using the Drupal Moodle Integration [6.x-1.x-dev] and Quick API [RIO 6.2] modules using Drupal 6.4 and Moodle [] to get as close as possible to your stated Tested config in the Install.txt file and I just can't figure out what the integration is supposed to do. I can't even get new Drupal accounts to show up in Moodle.

Do you have either additional documentation or an example/demo installation of this combo?


The Moodle module does not do

The Moodle module does not do anything with user creation or authentication. I thought I stated that fairly clearly on the project page at http://drupal.org/project/moodle but if you have suggestions about how to better describe the functionality, I would be happy to incorporate them into the text there. What the Moodle module does do, however, is allow you to see data about which courses a Drupal and Moodle user is enrolled in, has completed, etc. It pulls course data about users from Moodle and displays it in various ways on Drupal. The interface has been written to make it very easy to extend what kind of Moodle data is pulled into Drupal, by using a RESTful API.

Is this project still active?

I am interested in this but some of the pages don't look active. Is this project still alive?

Yes, the project is actively

Yes, the project is actively maintained.

Issue just placed on Drupal Moodle project queue

Hi, Chris.

I'm preparing to offer a workshop about Drupal + Moodle integration. I don't know how frequently you check the Drupal queue, so I'm providing a link to the issue here:


I'm on EST if you'd like to speak on the phone...just email me and ask for my number.


Question about SSO.

I have installed Drupal 6.20 and Moodle 1.9 and the required OpenId modules in both for SSO. When I login to Moodle I am now redirected to my Drupal installation for OpenId login. When I click on the moodle link however, Moodle tells me I am not logged in. I have searched for hours now and find nothing helpful. Any thoughts?

True, but then we need to

True, but then we need to carefully set up the access restrictions for an 'authenticated user'. I usually use this role to set the default permissions for each user, with OpenID, I'll have to make sure to set these slightly differently.

Hi Chris,Nice Tutorial about

Hi Chris,

Nice Tutorial about Moodle SSO.
But when i am getting some Issues when integrating the open id Plugin into Moodle.
and also when i am trying to Integrate qapi with Moodle 2.2+ version i am getting issues?

is the Procedure you Explained will work with Moodle Latest version(2.0.2) or not

Please Help me.

Thanks in Advance