I have reviewed over 30 Moodle 2 plugins now for my blog and have tested well over 100 in the last few years and for the most part there no problems as people generally follow the Moodle development coding guidelines set down in the developer documentation.
However, there have been a few common issues which I have come across so I thought I should do a quick post on them.
1. Hardcoded table prefix
Although the default database table prefix is mdl_ it is prompted for change when installing Moodle, so it may have changed. I always use a different one per site, and I have seen that approach for others as well. So consistent use of $CFG->prefix instead of mdl_ ( for Moodle 1.9) is important or the module just wont work for some people.
**Note As Tim pointed out below, in Moodle 2.x it should be ‘… FROM {table_name} …’, not “… FROM {$CFG->prefix}table_name} as explained on the page of Moodle Docs which explains how to get data in and out of tables.
2. Missing language strings
Quite often I have installed plugins which don’t use or don’t fully use the language strings and end up with missing text, hardcoded text or variable names showing up. This means the interface can be confusing, or show errors for undefined variables.
3. Lack of Documentation
Sometimes I have gone to install and use the plugin only to find that there is very little documentation about how to install it (if it is not obvious) or how to configure it correctly. Sometimes there is no README in the zip of the module, and no Moodle Docs page. Sometimes even the in-page help and guidance on how to set it up is also not complete or non-existent.
So they are the 3 most common issues that I encounter when trying modules, although I have to repeat that most modules don’t have these issues.
For those who plan to write plugins a good place to start is the Developer Moodle Docs which has all this kind of stuff detailed. There was also a great book on Moodle development for Moodle 1.9 written by Mike Churchward and Jonathan Moore which has a lot of good advice on the approach to Moodle development.
Of course, in Moodle 2.x code, it should be ‘… FROM {table_name} …’, not “… FROM {$CFG->prefix}table_name} …”.
Thanks Tim, added that note and linked to DML docs.