[RFC] API for Plugins (MODs)

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Post Reply
User avatar
Prince of area51
Registered User
Posts: 133
Joined: Mon Jun 27, 2005 8:46 pm
Location: Manchester, UK
Contact:

[RFC] API for Plugins (MODs)

Post by Prince of area51 »

As we are starting from a blank canvas, I think we should work towards have a system where the core code (shipped with phpBB) remains intact. What this means is instead of modifying phpBB files, we should allow the modders access to a set of functions that do the same job.

For example, borrowing from Wordpress, we can divide our API into:
  1. Actions
  2. Filters
1. Actions
Actions are the functions that are called at specific points during execution, or when specific events occur. The plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.

For example, a plugin can register its function by:

Code: Select all

phpbb::register_action('remove_post', array('my_plugin', 'remove_row_from_my_table'));
We can bring priority to queue the firing sequence.

2. Filters
Filters are functions that modify the data passed to them.

For example, a plugin can register its filter by:

Code: Select all

phpbb::register_filter('post_date', array('my_plugin','format_date'));
I have a few more ideas and will expand this as soon as I get some time.

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: [RFC] API for Plugins (MODs)

Post by code reader »

the distinction between actions and filters is 100% artificial.
a "filter" call can do stuff in addition to changing the data (indeed, how can you prevent it from doing stuff? it's php code supplied by a 3rd party, and if they choose to do stuff they will), while an "action" type call should also be allowed to modify the data, if there is such data at this specific call site.

you might want to look at viewtopic.php?p=202881 and see how close this is to what you have in mind.

hkais
Registered User
Posts: 2
Joined: Sat Jan 26, 2013 12:52 pm

Re: [RFC] API for Plugins (MODs)

Post by hkais »

hello all,

I love phpBB!

The major issue is, that I have to manually change distribution files of phpBB to add mods.
So from the point of software development, I have to do a own revision control system on EVERY phpBB Installation. Since no default setup is the same on every server I have to do a bookkeeping of every installed MOD. On a update of phpBB, I have to do a resetup of all MODs again.
You can Imagine, this forces user to skip important (security) Updates to reduce their effort and the risk of not working forums.

Just look through the MODs. If there MODs, that are easily installable, but need to fix some original phpBB files, I think there is a missconception in the MOD system of phpBB3.

If phpBB4 would have a clean API (like CMS systems Joomla/Drupal), developers and of cource users could easily add their MODs separeted to the phpBB core. No manual patches of phpBB and no complex setup docus would be necessary.

How you call the plug-in system, actions, filters, bb-plugs, or any thing other wouldn't matter from the point of the MOD-developer or a user. It is important, that it is easily maintainable and easily installable.

keith10456
Registered User
Posts: 523
Joined: Sat Apr 22, 2006 10:29 pm
Contact:

Re: [RFC] API for Plugins (MODs)

Post by keith10456 »

This was/is already being addressed ;-)

Post Reply