WordPress: add_filter or add_action? It actually doesn’t matter!

It’s a doctrine of WordPress plugin development:

Use actions to expand the functionality and filters to change information.

We’ve all heard it, we always follow that demand. Always? Well…

… if I want to add some functionality and nowhere near or far there is an action hook in the core but only a filter hook, I use that hook without considering the doctrine.

Surprisingly it works. But why? If we all insist that you have to use the right hook type, there has to be a difference between them. Let’s take a look behind the scenes (/wp-includes/plugin.php):

What? add_action does nothing but call add_filter and nothing else? There is no difference in functionality, it’s only a different name. So there is no reason why you shouldn’t use add_filter instead of add_action if you have no other solution.

I don’t say that you should interchange filter and action hooks at will. Using the correct hook type makes your code more readable and maintainable, for yourself and for others. Nevertheless, if there’s not other way to accomplish your goal but to use a filter hook instead of an action, don’t hesitate, it virtually makes no difference.

Firefox Add-On version hack: Cutomize titlebar

If I want to tweet a link of a site currently opened in my Firefox/Waterfox browser I using the “Hootlet” from “Hootsuite”. This little Add-On simply takes the text  of the titlebar of the browser and adds an ow.ly link so I can tweet it with a single click.

Unfortunately Firefox adds “Firefox” to the titlebar which I have to delete manually every time. But hey, computers are for automationing things so this should be automated, too. The Add-On repository contains an Add-Ons called “Customize Titlebar” which would do exact the requested task but it hasn’t been updated 2009 and is compatible with Firefox 3.9 (!).

In many cases those Add-Ons still work with current versions of Firefox the only problem is that they are marked incompatible. It’s always worth a try to simply increase the entry and check if it still works. Especially Add-Ons that are not critical like “Customize titlebar”. In this case this little hack actually works and I’m happy to be able to use the plugin.

I set the compatibility information of the Add-On to “50.*” so it should work for some while.


First meeting for launching a hackerspace in Kassel/Germany

Kassel, a city located at the Fulda, population 200,000, is as ugly as sin but it’s got the <a href="Herkules, a pile of museums, a great hackerspace, a national theatre, a university

Wait, wait, wait! A hackerspace? In Kassel? No, of course there isn’t one. Not yet. But there could be soon. Some people thought they could change this state and create such a space in Kassel, whereby space does not exclusively has to be taken as a physical room.

So the call went out into the great wide open of the Internet and the initiators hoped for a small group of interested people. at the first meeting in a small pub this small group turned out to be a large group of 28 combatants.

Unfortunately the locality was quite unsuitable for such a large group. If only five or ten people had shown up it would have been a nice and cosy get-together but actually we had to make the best of the circumstances. Some verbal contributions could hardly be heard others not at all. But nobody could expect such an immense interest. Nonetheless everybody was concentrated and the discussion was quite constructive. After a short introduction to the basic ideas of hackerspaces everyone told a bit about his background, his intentions, ideas, and expectations. I think a lot of Blinkenlights will be created in the near future.

Obviously there is a great crowd of hardware freaks, programmers, and artistically interested men (yes, there wasn’t a single woman) having many ideas for new and/or interesting projects  and ideas how they can help others and how others can help them. The initiators presented a welled planned  concept and even looked after some affordable rooms with a good infrastructure. Next week we will have a go and see.

Hopefully everybody will keep at it and the new hackerspace will have a good substantial and financial foundation. It’s going to be interesting!