Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the talk.
This is a draft specification outlining changes to the custom user profile fields to extend the functionality to generic custom data fields that may be applied to moodle objects
Description
We are seeing an increasing number of requests for adding additional fields to be associated with users and courses. Information to be stored against users can already be achieved through the custom user profile fields, although the interface is sadly lacking. However associated custom data with other areas of moodle, eg courses, currently requires hacking of the code. It is the goal of this document to provide a specification to allow the addition of custom data fields to be associated with any moodle objects with a consistent interface and API functions that allows for easy integration with existing and 3rd party plugins.
Moodle Objects
In this specification a moodle object refers to any one of the following: user, course, course category, file, group, cohort, activity module, block
Specification
API functions
Database tables
The database tables will closely reflect the existing custom user profile field tables
data_category id, name, sortorder
data_data id, userid, fieldid, data, dataformat
data_field id, shortname, name, datatype, description, descriptionformat, categoryid, sortorder, required, locked, visible, forceunique, signup, defaultdata, defaultdataformat, param1, param2, param3, param4, param5