Blog Archives
Moodle+wordpress single sign on
As i mentioned in Moodle + wordpress Integration Do all the steps and change the auth.php file inside auth/db/auth.php with the new auth.php
if your using moodle outside the wordpress you have to install and activate root cookie plugin in wordpress then logout and login. else your using inside the wordpress means no need of the root cookie plugin. If you are logged in as admin in wordpress it will conflict if open a moodle. So that it must be neglected and separate login should be done the admin users of both the site. You cannot get logged out directly if your wordpress user in moodle. You have to move to wordpress and the only get logged out. Only if your are a moodle user you can log out directly.
enable external database authentication plugin and update the settings as mentioned earlier.
Put the following code in theme which your using layout/general.php and activate it.
require_once($CFG->dirroot.’/auth/db/auth.php’);
$auth=new auth_plugin_db();
$auth->check_cookie();
Moodle+wordpress Integration
- Click site Administration->Plugins->Authentication->Manage Authentication.
- Enable External Database Authentication.
- Then Click on settings.
- Fill the form as below.
Host as localhost. Database as MySql. DB Name as WordPress DataBase Name. DB User as WordPress DataBase User Name. Password as WordPress DataBase Password. Table as WordPress Users table (Mostly wp_users). User name as user_login. Password as user_pass. Select password format as WordPress.
- submit it by click save changes.
- Now user can login with the wordpress user name and password.