b2evo: Plugin Basics

Like WordPress, b2evolution has user contributed plugin directory. However, many are outdated and many link to nowhere (ie broken links). Can’t really find what I want there.

(Update: found a plugin directory hosted on SourceForge.)

I attempted to write my own. However there aren’t much resources on how to do it, other than looking at plugins shipped with the release and some dummy examples. Documentation is also outdated and not very helpful.

This isn’t intended to be a tutorial. It’s just some basic information on the starting point. Some information I wish it’s more easily accessible.

Location

Plugin files are under /<path/to/site>/plugins. Will be referred to as /plugins hereafter.

A plugin can be a file directly under the /plugins directory or under a subdirectory with other related files.

File naming convention

The file name format for plugin file:

_<name of plugin>.plugin.php

Subdirectory name format:

<name of plugin>_plugin

Plugin template and content

Create a plugin file based on skeleton.plugin.php

Also look in _test.plugin.php for samples. Not the best example but it’s a good starting point to know what hooks are available.

Hooks

Like many open source software, b2evo provides some hooks to allow plugins to ‘hook’ codes into the system without making changes to core codes.

For a complete list of hooks, check /<path/to/site>/inc/plugins/models/_plugins_admin.class.php. Look for get_supported_event().

The description is quite brief. If you don’t understand how it works, they may not make sense. It took me a while to go figure out by going through source codes.

Coding Examples

As mentioned, b2evolution is poorly documented. You need a lot of researches, trials and errors to make it work.

One of the best place is to go to the forum. You can find some information and ask questions. I was able to make a plugin required by a project as a result of seeking assistance from the forum.

Another place is to check plugins for quam pluresquam plures is another blogging software forked from b2evolution, started by a group of users who used to use and / or develop b2evolution. Some plugins that were broken linked from b2evo’s plugin directory can be found here.

At this stage the codes are quite similar and you should be able to work something out from the source code. I got some of the tricks from these plugins too.

I’m very new to plugin development and I may have missed something. If you have any tips and tricks, please let me know in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *