Skip to content

Login into Moodle using XMLNuke

Joao Gilberto Magalhães edited this page Feb 6, 2014 · 1 revision

You can login into moodle without big changes in your project.

To do this you only need to change two anydataset files.

Step 1: Create a connection string for your moodle database

Add to your "_db.anydata.xml" how to connect your moodle mysql database following the example below:

<anydataset>
        ...
	<row>
		<field name="dbname">moodle</field>
		<field name="dbtype">dsn</field>
		<field name="dbconnectionstring">mysql://user:pass@host/database</field>
	</row>
</anydataset>

Step 2: Edit your config.inc.php

Edit your config.inc.php to add the name of the connection string defined in the field 'dbname' above (in our case is 'moodle') and the class to manage the moodle login.

$values['xmlnuke.USERSDATABASE'] = 'moodle';
$values['xmlnuke.USERSCLASS'] = '\Xmlnuke\Core\Admin\UsersMoodleDataSet';

Notes

  • This class was tested on Moodle 1.9 and Moodle 2.x and can validate hash passwords with md5 and cript algorithms.
  • This class expects the prefix 'mdl_' the moodle tables.
Clone this wiki locally