Connecting wordpress and moodle

For a current project I setup wordpress as CMS and community tool and moodle as e-learning platform (there are wordpress plugins available like sensei, but moodle is simply the most advanced software available right now).

One of the hardest parts was to bring the two systems as close together as possible. I thought about using LDAP for the user authentification (both systems can authenticate against a LDAP server) but while researching I found an awesome wordpress plugin: External Database Authentication Reloaded

This plugin lets you define a database table and columns you want to use to check a users logindata. You can simply input your moodle’s database credentials, select moodles user table (which was ‘learn_user’ in my case) and then select the username and password columns in the table (thei’re actually called “username” and “password” in moodle).

The right password encryption method is “phpass” (“pH-pass” not “php-ass”) for moodle v2.5 and later. You can add a role check and require the field “confirmed” to be “1” to only allow confirmed user accounts to login. Also some more userfields like e-mail, firstname, lastname, … can be mapped.

That’s it! When somebody tries to login to your wordpress site all user data will be taken from moodle’s user table.

This is not a complete single-sign-on solution, but for the effort taken it’s a quick and easy solution to only require one registration.