Thursday 19 October 2006 by sencer

Sometimes I have the impression that some people are missing some of the possibilities already available, when it comes to customizing the admin area in Textpattern. So I thought I’d give a few quick pointers where you can start. Please feel free to add other plugins or ways you use to customize the admin-area.

rss_admin_show_adv_opts

This allows to automatically expand the “advanced options” and/or the “more” link on the write tab. If you look at the source of that plugin you’ll see that it’s basically one-liners that add the javascript functions that toggle them to the onload-event via the special addEvent() javascript-function that was introduced in 4.0.3.

addEvent(window,'load',function() {toggleDisplay('more');});

You can easily change it, or add to it, to expand recent-articles or textile-help as well. And of course the principal method of manipulating the DOM to add, remove or change the HTML code is available for plugin developers to go crazy with on all tabs.

ied_hide_in_admin

This one allows you to hide a large list of UI-elements on various tabs in the admin area for different user levels. It is configurable via an additional tab. Helpful if certain UI-elements are not used anyway.

hpw_admincss

This is also a plugin that consists of only a few lines. It rewrites all pages (via output-buffering) to add an @import url(“css.php?n=admin”) in the <head> area, and adds an id (with the current event) to the body tag. Now by creating a stylesheet with the name admin you can customize the style of the admin-area, be it colours, images, font-sizes etc. Textpattern 4.0.4 has cleaned up markup with additional clased/ids where appropiate, so that a lot can be achieved this way. IIRC somebody (wink, wink) is writing on an example article to illustrate this a bit more.

Replacing complete tabs

The plugin architecture also allows to replace complete tabs, by registering the appropiate event. One plugin that used this was a hitlogger-plugin (the name escapes me at the moment) which replaced Textpattern’s own logs page. I’ve also written a (proof-of-concept) dashboard-plugin (some more explanation) which uses basically the same technique.

Conclusion

While of course all of the above can also be achieved by simply hacking the textpattern-files, that is usually not recommended, as it requires special care and maintenance costs when updating your textpattern installation, and is also more error-prone when troubleshooting. While there is no 100% guarantee that every plugin will continue working after an update, I think we have a fairly good track-record in that respect for the vast majority of plugins out there since the 4.0.0 release. It’s also simpler to switch on/off a plugin, or to tweak it’s behaviour a little bit, than having to hunt in textpattern source files for the right lines every time. So where possible also prefer the plugin solution over a dirty hack.

As you can see with a little Javascript, CSS, HTML or PHP (depending on what your strengths are and what you need) you can go a long way in customizing the admin-side with 4.0.x as it is. And of course with the next major release, we’ll see that the admin-side markup is even friendlier to CSS/JS manipulations/customizations (he said, and was met with cries of “kill the tables!”, “more semantics!”).

I am looking forward to read what other people have come up with that I missed. Do you know any other noteworthy plugins in this respect? Or maybe you want to suggest/request a new plugin knowing the above… go ahead.