Developing/programming plugins can be done quickly and, of course, it’s needed. But if you want to make it available to the world, it is necessary to observe some rules, it’s like writing diploma or thesis at university — you seem to understand what it was about and can explain the fingers on your research, but we need to keep a lot of formalities, and this is true. So one of our Moodle plugins were able to show the world. It is now available for download in the official repository of plugins Moodle.
LenAuth module was developed long time ago for one of our clients and all there runs like clockwork, so it was clear about understanding plugin work, writing a detailed documentation was unnecessary. In the summer of 2014 it was decided to make a number of improvements to connect some of the international social network with the popularity of the world (before this was Mail.Ru, Google and Facebook). And we started…
Difficulties that we encountered
Looking similar plugins we saw a lot of different web services, which established OAuth-authorizations, such as Linked-in, Windows Live, and even GitHub, indeed, a data connection to social services is easy enough, but whether it is, if your students are ordinary people, that have, as a rule, accounts in 1-2 popular rather than specialized social networks. At the same time, a feature was that we never found authenticate via Yahoo and Twitter, but then it became clear why. The fact that these social networks rather complicated system OAuth-authorization, which differs from the standard system (OAuth version 1): two redirect instead of one and, consequently, a larger number of requests, in general, we have assigned the responsibility “to meet” Moodle with OAuth-authorization methods Yahoo and Twitter. It was difficult, the hardest part was tested when surfaced more and more nuances, but we did it. With Twitter had similar problems as with Yahoo, but suddenly, for us, it was found that their web service does not return the correct information to us: name, family name, e-mail, but from useful returns only internal Social ID. Then we decided to make the following:
The process of plugin uploading to Moodle repository
All the nuances of plugin uploading and approval process to Moodle repository we will describe in a future article, but now we describe specific errors, which we pointed by administrators of Moodle plugins repository (much respect and thanks to David Mudrák).
- It must be remembered that Moodle, as a database, can use MySQL and PostgreSQL, respectively, request rules a little different, we pointed that, so little fix for that.
- Everything inside plugins php-files need to be protected from intruders calls by a special code at the beginning of the file
defined('MOODLE_INTERNAL') || die();, one file was unprotected.
- Moodle core-programmers love when internal variables (configs) functions and classes used in its name the style Frankenstyle. This is not a requirement, but keep in mind!
- Then we ourselves have noticed that people are deprived Yandex.com and authenticate them offered through the Russian Yandex.ru.
- Almost all of the plugins store their data in the config Moodle database and can be pre-defined and resave, they must necessarily predetermine.
- To avoid errors when the plugin has been integrated, and then it was removed — added documentation check for the existence of files plugin.
- Recently in function
get_string()was added a third option — to pass variables in the output string translation. In some cases, we had declared this variable explicitly, as are all changing rapidly.