- b2evolution CMS User Manual
- Developer Reference
- Plugins
- Plugin development
- How to write a new plugin
How to write a new plugin
This man page refers to b2evolution version 1.6
The easiest way is this:
- Make a copy of the file _test.plugin.php
- Rename the new file to _newname.plugin.php (choose whatever newname you want)
- Open the _newname.plugin.php file.
- Rename the class from test_plugin to newname_plugin . Make sure you use the same newname as above. Note: when renaming the class, you must also rename the constructor (first function). (Doing a Search & Replace on test_plugin in the whole file would be a good idea in order to update comments also).
- Give appropriate values to all variables in the section "Variables below MUST be overriden" as well as in the Constructor.
- In the section "Variables below MAY be overriden", redefine everything you need and delete anything you don't need. You may want to check /b2evocore/_class_plugin.php for additional possible variables to override.
- In the functions list, delete all functions you don't need, and reimplement the ones you need. You may need to keep only one function. The TEST plugin reimplements almost all event handling functions, however you may want to check /b2evocore/_class_plugin.php for additional possible event handlers to override.
When you're done, make sure to install your plugin in the Settings admin before you attempt to use it.