Skip to content
Chris Murray edited this page Nov 26, 2013 · 3 revisions

SetlzerCRM can be extended through its module system.

Creating a Module

The basic steps to create a module are:

  1. Create a php file. For example, create foo.inc.php if your module is called "foo".
  2. Add a function "<module name>_revision()" to the file (eg. "foo_revision()"). For a new module, it should return 1.
  3. Add a function "<module name>_install($old_revision)" (eg. "foo_install()"). This function should run any database installation code if $old_revision is 0.
  4. Optionally add an init function "<module name>_init()" to be called when the module is loaded (eg. "foo_init()").
  5. Add any data, table, form, and theme functions.
  6. Place your file in the crm/modules/<module_name>/ directory (eg. crm/modules/foo/).
  7. Add your module to the $config_modules array in config.inc.php. Make sure to add it after any modules it depends on.

Modifying an Existing Module

  1. Modify <module name>_revision() to return a the number one higher than the previous version.
  2. If changes are required to the database, add the code to make those changes to the end of <module_name>_install($old_revision). They should only be run if $old_revision is less than the revision number returned by <module name>_revision().
  3. Visit the upgrade tab to run your installation code.
  4. Make any other changes to the code.