glFusion Wiki

Site Tools



  • Use the Plugin API calls.
  • May be just a basic add-on with PHP code, but are normally more advanced.
  • Could be just a way of auto installing a block with no admin, user, search or comment features.
  • Require as a minimum the following four files: config.php, (with at least the uninstall function defined), language file, and install.php.
  • Usually have at least one new table.
  • Integrate core glFusion functionality and features.
  • Are a good way to integrate a separate software solution, and integrate the installation for easier distribution.

Why a Plugin

There are several blocks that can be personalized or have user settings. There are several examples that have extended user preferences. There is no right or wrong way but the following list outlines some of the reasons you may want to develop a plugin vs. a block or convert a block to a plugin.

  • If the add-on has a My Account block or an an administration component. The description and links can be automatically added to their related menus for the user.
  • With a plugin, users don't have to modify lib-custom.php or add table definitions to lib-database.php. They are automatically included as they are referenced in the plugin's files. The plugin's file can also include the phpblock function if the addon has a block feature.
  • Users do not have to manually create tables or run a SQL script. The plugin install program will have the SQL to create the new tables.
  • The add-on can check for the user's language setup and if there is a corresponding plugin language file. If this is done in or the config.php, the variables will be created as globals and allow you to easily reference them in your addon.
  • Extend your project to utilize some of the Plugin API's and integrate glFusion core features:
    • Extend the glFusion search to include your plugin results.
    • Add your project to the site stats listing. It is very easy to include the number of records in your plugin to the Site Statistics and you can optionally add a more detailed stats function.
    • Enable your addon to use the comment engine and allow comments.
    • Enable moderation so that new plugin items need to be approved before posting to the site.
  • The auto install and unininstall is one of the most important benefits. Once the site admin understands how to copy the plugin distribution files to the proper directories, the install is all done online with no file editing. The install script includes error or status logging which helps in troubleshooting. If there is an install error, the installer removes everything.
  • Automatically add a link under the site header to your plugin feature. Themes can reference the variable {plg_menu_elements} in their header.thtml files. This variable is defined by making a call to all plugins and if the function getmenuitems exists, it can return the link and description to be displayed.
  • The install program creates any add-on security groups and access rights automatically. It can create the block definition as well, so the user does not even have to use the block editor.
  • Once you have a working project, it should only take a few more hours to make it a working plugin.
glfusion/development/pluginapi/whatisaplugin.txt · Last modified: 2016/10/09 10:09 (external edit)

Page Tools