moodle 3 – creating my first demo authentication plugin

Posted on March 23, 2010 in Moodle

I got started adding the new authentication plugins that i need to write – this post contains boring details – you have been warned before reading more, so if you are brave

First I went to moodle/auth/ .. since i saw there the list of plugins, each in a folder, i figured i’d add my own folder, so there goes my ambrow folder, in the web interface, i get an error that ambrow plugin is missing … good news

So i go forward to plugins and notice 2 files exist all the time : auth.php , config.html … i copy paste 2 files into ambrow folder …tara.. get an error .. in the meantime i google “how to write authentication plugin for moodle” , I end up on this page

After some playing, those are the steps that are needed :

1 – create folder under moodle/auth/ambrow

2 – create 2 files – auth.php , config.php

3 – in auth.php – create a class auth_plugin_ambrow that extends auth_plugin_base from /lib/authlib.php. ( Need to require_once the authlib file.)

4 – Implement the user_login() function in auth.php file or any other function that needs to be over-written

5 – Inside moodle/auth/ambrow create a folder called lang , then inside of it another folder called “en_utf8? ( that folder name might need to change, to figure it out check what is used under moodle/lang )

6 – Inside moodle/auth/ambrow/lang/en_utf8 , create auth_ambrow.php ( name must start with auth ) – Inside of it , set $string['auth_ambrowtitle'] = ‘Ambrow’; for example

7 – login to admin interface… tara

For more on language language strings in moodle, this is the ressources doc from moodle.org , i guess i will be taking a look into arabizing or chinesing the interface later on if needed.

Share Button

Leave a Comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>