Introducing: plugin order

So, it’s been over a month since we moved in at our new code repository, we already acquainted ourselves to the place and added a few new features to what will then become Textpattern 4.0.7. I thought I’d explain one of these upcoming features in greater detail: plugin order.

In the order of appearance

Every once in a while, when you happened to stay long enough in your movie theater’s seats to watch the end credits, you were introduced to the cast “in the order of appearance”. Textpattern plugins are loaded likewise: Whatever plugin got installed prior to all others after a site’s initial setup, is loaded first upon every page request.

A majority of plugins wouldn’t be affected by this lack of any method to specify a loading priority: New template tags or back-end extensions are always ready for work when the real action starts. Others suffer from this omission, most apparently those which deal with URL rewriting or comment spam detection and handling – you’d certainly want a junk-repelling plugin to weed out spammy entries before any comment subscribers are notified.

Not all plugins are created equal

With Textpattern CMS 4.0.7, we will introduce an additional plugin property to rearrange the loading sequence for such cases. It’s a single digit starting at 1 and running up to 9, where all plugins with their order set to 1 will run first, most plugins will probably run at the default intermediate order at 5, and some will make sure to be the last in queue and run with an order of 9.

Plugin order can either be determined by the site administrator at the plugin screen, or set at a recommended value upon installation, so site owners won’t even be bothered at all.

Questions, anybody?

Is this of any importance for a site owner?
Hopefully not. Plugins which work with our current release will continue run at the default order without any modification in the next release as well. Nevertheless, a site owner can be specific about it if she cares to.
Is this of any importance for a plugin author?
Authors of plugins who rely on a specific order can specify this order in the plugin’s code. There’s one optional line to incorporate in the plugin’s header to reap this capability1: $plugin['order'] = 5;.

Wait… don’t leave… there’s more…

Textpattern CMS 4.0.7 will sport a few more additions which appeal to the designers crowd rather than to the coders. Ok, I see, you’re busy. So, we’ll report on these later to avoid overstretching your attention span too long…

1 Download the complete plugin template here.

Comments

  1. Cool!

  2. What about people who just put code as PHP files in their plugin directory. That code gets run even though it’s not a plugin. Are these all “1“s or something?

  3. Can’t wait to see…
    Thanks…

Commenting has expired for this article.