Get it All
Together

As I’ve continued to learn about WordPress MU, I have discovered a world which is surprisingly undiscovered, it seems.  The veterans at WordPress are already familiar with how things work, but the documentation isn’t there quite yet (in truth, there’s precious little on even plain WordPress).  Meanwhile, the site WPMUDEV.org has been assembled to help out developers, but that’s woefully incomplete and often inaccurate.

The funny thing is: the WPMUDEV people have recently announced a premium service for those who want to spend a bit of extra cash.  Well, given the inconsistencies of the publicly-available content, I have trouble understanding why anyone would pay extra, but to each his own.

Case in point: the Post Ratings plugin that has allegedly been retooled to work with WordPress MU.  I won’t bore you with the gory details, but suffice it to say, the plugin was most definitely not working on this very basic site.  I decided to take the opportunity to play around with it and see if I could get it to work, and in doing so, learn a little bit more about the way MU deals with plugins.  I’ve decided to go over some basic concepts here before eventually putting them into the WikiMU.

/plugins vs. /mu-plugins

One very confusing concept behind MU plugins is the difference between the two plugin directories.  This seems to be a fairly frequent subject of discussion on the MU forums, but really, it’s not that difficult when you get down to brass tacks.

Plugins stored in the /mu-plugins folder are site-wide, mandatory plugins that the Administrator of the site controls.  Administrators of individual blogs have no control over these plugins and do not see them except where they have an effect on the final product.

Plugins stored in the /plugins folder are available site wide, but Administrators of individual blogs can determine whether or not to include the plugin on their blogs.  Now, the tricky part about this is that there is an option under Site Admin that allows or disallows the “Plugins” menu for Administrators site-wide.  If you don’t check this box, plugins saved to the /plugins folder won’t be available to site Admins to use.

Well, now, hold on a minute. . .  What’s the point of the check box to enable plugin control?  I don’t know the answer to that, but it seems a bit superfluous.  Whatever is the case, none of this is at all obvious when you install MU.

A second challenge is the fact that plugins installed in the /mu- directory shouldn’t just be dropped in and forgotten about. You’d like to be able to set options for these plugins, but so far, I’ve not seen a single plugin that actually provides control panels.

Developing Plugins for MU

It is the lack of control panels that makes working with MU plugins so challenging.  In fact, as near as I can tell, it is precisely this barrier that is preventing me from working with the Ratings plugin in MU.  The plugin requires you to set a default rating icon (stars, bars or squares) and since I don’t have an Admin panel that I can see, I cannot set this option along with who-knows-what other options.

So going forward, I’m going to need to figure out how the Post Ratings plugin creates its panels and hack that to move the panel somewhere accessible.  Any other future plugins will also need to take this need into account.  I still don’t know how they do this yet; I asked the question in the MU Forums and was told that there are plugins on WPMUDEV.org that do this, so I should just check them out.  Well, considering the luck I’ve had with the crappy plugins on this page, I think I can be forgiven if I don’t care to keep pluging in stuff that doesn’t work until I find the right one.

I think perhaps I’m going to try to work on some sort of convention that allows for a plugin to be stored in either the /plugins directory or the mu-plugins directory, changing the admin panel appropriately to match.  But of course, this is all very far in the future.  I’m going to need to have more than an hour to sit down and play if I’m going to work on a project like that, which at the moment is all I have.

OK, so I’ve been playing around with the postratings.php plugin that was supposedly for WordPress MU.  Like hell, it is.  I’m still jerking around to try and get this thing working, and so far, all I’ve managed is to make the bastard not bork my entire blog.  At least, so I think.

But of course, if you’re reading this, then I’ve definitely avoided a catastrophe before I went to sleep this evening.

I’ve posted two new articles a few days ago. Their sole purpose was to test the Clean Trunks plugin in the MU environment. It appears as though it will not work without some modification.

The first, most obvious trouble seems to be that Clean Trunks needs to be kept in its own directory, and cannot have the two component files dumped into the /plugins directory on their own. If I put the plugin component files directly into the /plugins directory, the plugin engaged enough to pop an error message stating “the second argument was invalid in file clean_trunks.php on line 121. That seems to suggest that the call to create the object isn’t working correctly, causing this line to be in error:

if( in_array( $word, $this->stopwords ) ){

I take this to mean that the object that the $this variable refers to does not have the stopwords variable defined or that the object is not getting created. I’m not sure. I didn’t get a chance to work on this problem, specifically this weekend.

What I have done was to install the Plugin Manager plugin off the WPMUDEV.org site. This plugin makes it possible to globally activate or deactivate plugins in individual blogs. This brought up an interesting question for which I have found the confusing answer here. Namely, what is the difference between the /plugins folder and the /mu-plugins folder?

The answer is that the /mu-plugins folder is meant to contain plugins which are turned on globally with no options available to individual blog administrators or users. The /plugins folder is meant to contain plugins which are globally *available* but not turned on unless the blog administrator chooses to do so. However, in order for the blog administrator to make these choices, an option under Site Administration must be turned on that allows for a “Plugins” heading in the Administration Panel.

Whoopha! That’s a little confusing. Especially given the fact that plugins for the MU environment seem to be hit-or-miss, with little to no documentation. Some work in one directory but not the other, when really, you’d want to have the option to use both in this environment. I know I’ve been doing it wrong for the last week, myself. I’m going to need to rethink how things work, but really, going forward I would like to write plugins that take into account which directory it is installed in and provides appropriate options for both.

But I’ve got a lot to learn. Unlike my previous adventures with WordPress, this time, I’m trying to really get a handle on how the core works, if only in outline form. To that end, I have used grep on a Linux box I have to search out every instance of the do_action() keyword, documenting all the actions associated with WordPress MU. I now have a complete list of those actions, along with the files that reference them. I’ll eventually be putting together a Wiki to provide them here, but I’ve been having a bit of difficulty in loading the MediaWiki.

I tell ya, folks, WP2.1 just keeps getting more and more interesting every time I look into it.  If only I had time, I’d upgrade.  I’m still working on three projects that have to come first and just got a new gig working for Kodak, so I’m a bit booked.

Here is an interesting discussion of the new “pseudo-chron” functionality added to the latest version of WP. Yep, I can smell some new Widgety-goodness in the works, folks. I just need to find time to do it!

Timing is everything: scheduling in WordPress – Development on a Shoestring

What has been produced is a system that allows plugin developers to schedule events to occur at certain times. It does this by checking the current time against the list of scheduled tasks every time a page is loaded on the site. If the set time has passed the task (a callback function) is done.

Getting the scheduling to do what it should is going to require a working knowledege of how WordPress hooks, actions & filters work.

Technorati Tags: , ,

powered by performancing firefox

So, it took nine days, but it finally happened: someone has left a comment on the DragonFlyEye.Net blog looking for my JavaScript Animated Collapsing Categories Widget to be usable for Links as well.  For those of you who are not aware, the new version of WordPress changes the way Links work slightly, by making Links Categories part of the Categories table of the database.

That means that my plugin could potentially be used for Links, but as it sits, that’s not the way it works.  In fact, it works with 2.1, but it’s a bit wonky.  So, I’ve avoided upgrading because I didn’t want to distract myself from other projects to make this adjustment.  Now people are asking for it (and this is a very downloaded piece of code, I can assure you), so I have no choice: I’m “On the Code Again.”

So, I’ve been using FeedBurner for my non-blog feeds for quite a while, now. However, I’ve been hesitant to switch over to FeedBurner for my blog feed because I didn’t want to strand people who had been using the old feed link. (I believe I was just discussing the problem of stranding links, wasn’t I?) Well, lo and behold, there comes the following plugin for WordPress:

FeedBurner Plugin // Ordered List by Steve Smith

So What Does This Do? Using some WordPress plugin magic, and user agent detection, this plugin simply forwards all your feed traffic to FeedBurner. The plugin will detect all ways to access your feed (e.g. http://www.yoursite.com/feed/ or http://www.yoursite.com/wp-rss2.php, etc.), and redirect them to your FeedBurner feed so you can track every possible subscriber. It will forward for your main posts feed, and optionally your main comments feed as well.

Woo Hoo! If you’re like me, you said “Eu-freakin’-reca!!” and promptly read the download and installation instructions. The great thing about this is that you get all the advantages of using FeedBurner without the problem of stranded subscribers who don’t show up when you’re trying to get a feel for your subscribership on various feeds.

Technorati Tags: , ,

powered by performancing firefox