Besides manually updating six separate instances WordPress (to version 2.6) in the NMC fleet of sites, I also finally paid some over due attention to the version of WordPressMultiUser I have had up since November 2007. This tool some rustling to get it to the right version and also what had not been done in a while- making the front door.
I am hardly a WPmu guru, certainly no bavatuesday… maybe a bavalatethursdaymorning. Most places running WPmu are doing it to provide a blog hosting service, like edublogs or the crazy stuff the Rev does at Mary Washington.
My need was to have a series of separate sites hosted in WordPress w/o having to have an even bigger fleet of separate installs (Heck, maybe one day I can rope them all in under the WPmu hood). No these are all a series of online publications we have done at NMC in the lasy 8 months, all using the slick CommentPress template. Developed by the Institute for the Future of the Book, CommentPress provides a way to post a series of publication chapters as “blog” posts, but the special feature is that comments can be attached to individual chapters.
So we have things like the 2008 Horizon Report in this format as well as the text of a keynote given by Howard Rheingold on Co-Evolution of Technology, Media and Collective Action.
Until just a few minutes ago, these were separate little sites, but now I have at least a crude launch page for the entire WPmu site at http://wp.nmc.org.
Getting here meant first upgrading WPmu from what I had installed, version 1.3.3 to the just released 2.6 version (they bumped the numbers to be in line with the versions of regular WordPress). The documentation on upgrading WPmu is skimpy to say the least; the ReadMe file said it had to be done incrementally from 1.3.3. to 1.5.1 and then to 2.6.
Okay that is not too much.
Except I spent 40 minutes poking arounf the WPmu site and the WP Codex w/o any luck. Finally I tossed a tweet in frustration, closed the lid, and went outside to do some real work. But the twitterverse shined and came through as Kevin Jarret pointed me to the Trac code side.
Doh, right? How the _______ would anyone find that (without friends on twitter).
The upgrade process was pretty easy. Next was the fun part, starting to rip apart the template:
This is just the start.
(A) List of Blogs on Site
One thing I needed was a list of all the blogs on the site (each a different publication), so I reached for the list-all plugin which, as you might guess, returns output of all the blogs on a WPMU site, with some options for the order, and how many it spits out. I just put some code in my
index.php template to make a block that would appear above any “posts” as an index to the whole site:
<h2>Publications on this site</h2>
<?php list_all_wpmu_blogs('', 'name',
'<li>', '</li>', 'last_created');?>
The div was needed to add some styles so it would stand out a bit more. At first nothing happened; I got the header but no lists. I dug in the plugin to find the MySQL query and then ran it manually in phpMyAdmin- and sure enough, it returned no results. Then I looked at the query and my
wp_blogs table and realized it had a condition looking for a value of
public=1 and in my table, these were all 0s. I can only guess that either my database did not get a right setting or maybe it was a new column added. My hack was to modify values in te database to set all values of public to be 1.
This was fine, but the query in the plugin also was returning a link to this same blog. So it was back to the plugin code, finding the query and adding an extra condition to the query on line 89:
AND blog_id > 1so the main blog was skipped. That all worked.
The list-all plug in seems like a large chunk of code to do what I can see is a basic query, a lot of the stuff I did as described in WordPress Dissected. I plan to go back and just code in the query, which will allow my to pull and display other data, like the tag line, or the date published, or the number of comments, or…. With some MySQL know how, you can be a god. Sort of.
(b) List of Posts From Within
The next thing I wanted was a piece on the sidebar that would pull in content from among all the published papers within. There are a handful of plugins that do it on the WPMU Dev site, I chose Ada WPMU Recent Posts because it did so as a widget. I’m old school in my templates and have not done much with widgets except when forced to (like on WordPress.com). But since this blog was basic, I thought it would be worthwhile to get some widget experience.
It worked as advertised, and the options in the widget editor let me chose to pull Posts or Pages, and some options for ordering them.
The problem was a date order was not very interesting. When I create these Comment Press sites, I mend up cresting about 5-10 posts in a row in the same blog, because each one is chapter/section. So in this list, the would be all from the same blog because I di each site at different times.
So I tweaked the code slightly, by editing again the MySQL query that grabbed the posts, by changing line 224 in ada_list-all-posts.php (this plug is ironically built on top of the list-all.php plugin I used inn section (A)) which sets the ordering of the results to be in reverse chnronological order– I changed the line that reads:
$post_sql .= " ORDER BY post_date_gmt DESC " . $limit . "";
$post_sql .= "ORDER BY RAND() " . $limit . "";
so rather than getting 7 or 10 posts in order of most recent, I now have a random selection form across the site.
This is still in play mode. I want to add more that will pull comments form within the site to the front, and eventually some sort of site wide tag thing going.
Wow, I love tinkering in WordPress.
The post "Wrangling WordPress MultiUser" was originally pulled like taffy through a needle's eye at CogDogBlog (http://cogdogblog.com/2008/07/wrangling-wordpress-multiuser/) on July 31, 2008.