The new WordPress UTW gotcha

(Later – Scroll to the end of this post for a small patch to fix the problem with disappearing tags!)

As seen elsewhere and of course on the official blog, WordPress 2.1 was released to much fanfare yesterday.

It works great, I’ve been using the development version on my blogs for quite a while now and until recently it worked swimmingly. It still does, but some time in the last 2 weeks Ultimate Tag Warrior stopped working properly. Whenever someone made a comment on a post the tags on that post would be deleted. It’s gotten so bad now that I’m moderating all comments, and opening those posts in the editor before approving the comments.

A half-way fix is available but moderated comments will still delete the tags so once I verify that the fix does what it does comment moderation will go back to the way it was before.

You should upgrade WP-Cache to the new 2.0.22 release too. It fixed problems I was seeing here with comments and posts not showing up until I deleted the cache manually. Yay!

If you’re interested, a new WordPress MU release will follow in a day or so. More here.

I forgot to mention, do I recommend you upgrade to WordPress 2.1? Yes. If you run a site that is in any way popular your database server will thank you. WordPress uses the MySQL query cache in a much more efficient manner than ever before when reading posts. Make sure your query cache is activated and tweak it until you hit the sweet spot. It’ll make a big difference when your server is under load.

Fix Fix Fix!

HandySolo spotted a simple fix for the tag problem! Check out the thread on this post and scroll to the entry by 082net.com where he outlines a simple fix for the disappearing tag problem. I just tried it and it works!

Here’s a temporary patch for resetting tags.
Modify ‘ultimate_save_tags()’ function on ‘ultimate-tag-warrior-actions.php’ about line 502:
if (isset($_POST['comment_post_ID'])) return $postID;
if (isset($_POST['not_spam'])) return $postID; // akismet fix
if (isset($_POST["comment"])) return $postID; // moderation.php fix

Even with the fix above, deleting a comment will delete the tags, and sending a trackback/pingback will do the same. 082net.com fixed that too. You can remove the above fix and apply the following.
Around line 862 of ultimate-tag-warrior-actions.php find the following chunk of code:

// Save changes to tags
add_action('publish_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('edit_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('save_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
add_action('wp_insert_post', array('UltimateTagWarriorActions','ultimate_save_tags'));

Replace that code with:

// Save changes to tags
add_action('save_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
if($wp_db_version < 3308 ) { // if lesser than WP 2.0
  add_action('publish_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
  add_action('edit_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
  add_action('wp_insert_post', array('UltimateTagWarriorActions','ultimate_save_tags'));
}

PS. Stephen Spencer has discovered why UTW doesn’t always work with custom permalinks. This is a longstanding bug, and it’s why I had to use the ?tag= format on my photoblog.

We are live from BarCamp South East!

Here I am blogging away at BarCamp South East. It’s been a great day so far. My talk was scheduled for 10:50am which was a relief to get out of the way. Feedback has been positive too and horrors of horrors, I actually enjoyed the talk! Video and podcasts will be online eventually and I’ll update this post when they’re available. Elly left Bernie’s dictaphone on the seat next to me, Joe and Conor had video cameras so I’m sure you’ll get to hear or watch me talk about WordPress one way or another if you’re interested!

Thank you all for the comments on yesterday’s post. I’m hopeful that things will return to normal sooner or later on inphotos.org!

Now, I’m off to look around and mingle with the rest of the attendees!

Just spotted on Lifehacker, is How to manage kids in the home office, a topic brushed upon in my talk.

I’m sitting in the Drupal talk now by Alan Burke and Stephane Corlosquet on the laptop. John Handelaar is showing off his voter site written in Drupal. It’s a great presentation on the power of Drupal and it’s plugins.

Ken McGuire has a review of the day, and apart from everything else, and it was great to talk to Justin Mason finally.

Great day. I think everyone’s looking forward to the next one in May!

Conor O’Neill has posted videos of my talk on his blog. I could embed them here, but he went to all the trouble of uploading them, so go visit his blog and check them out. There are bits there about scaling WPMU by hashing blog_ids and partitioning databases, as well as how to get past the 32,000 file limit of ext2/ext3 in the blogs.dir files directory. Also, if you work from home I discuss my experiences doing the same, and communicating within a virtual company.

Bernie has posted the first podcast of my talk. He’s posting the second half tomorrow about working from home and in a virtual company.

The second part of Bernie’s podcast is online today! In this part I talk about working from home and balancing work and home life. Should be of interest to everyone working from home!

Getting to know the Trotts

Just goes to show what a hectic week it was last week. Despite it being on the front cover of the Business Section, I completely missed this Sunday Times interview with Mena and Ben Trott, the founders of Six Apart, makers of blog software Moveable Type, Vox, Typepad and owners of Livejournal.

It’s a personable interview that doesn’t go into any great technical detail but it’s interesting for me to find out a little about the competition from my outpost across the Atlantic.

Ask the developer

On January 20th I’ll be speaking at BarCamp South East on the subject of WordPress.com and WordPress MU. The talk is titled, “WordPress.com – running the biggest wpmu site in the world” which is vague enough that I could talk about anything but I’d like to know what you want to hear.

Public speaking isn’t my strong point, I prefer to be behind the keyboard, or looking through a camera lens but sometimes you have to push yourself to do unfamiliar things. Here’s my go at public speaking.

Talks will be in 45 minute slots and I would like to make mine more of a discussion forum like the WPMU talk we had at WordCamp way back in August last year. It went really well and everyone got something out of it.

Subjects I’m considering include:

  • Merging code from WP core which is horribly exciting, have you ever seen vimdiff in action?
  • Site stats – did you know we publish them?
  • Hardware – server porn. How do we handle the load generated by Slashdots, Diggs, and almost 600,000 blogs?
  • Hooks and plugins – new hooks in the signup process and wpmu admin backend.
  • Anyone interested in working from home and virtual company issues? Automattic has employees in at least four countries.

So, if you’ll be there I want to hear from you. If you won’t, I still want to hear from you because I’m sure Bernie or someone will record the talk and put it up online.

Caching WordPress with WP-Cache in a spam filled world

WP-Cache and spam. Who’d have thought they were related? Unfortunately they are because when your blog is spammed WP-Cache doesn’t check if the comment is legitimate or not and deletes cached files related to the spammed post.

I noticed this happened a lot on In Photos.org after I added thumbnails to the top of the page. The thumbnails change when the page is regenerated but I noticed that they would change much more frequently than expected. After some debugging I realised that comment spam was invalidating the WP-Cache cache.

How do you fix this? Here’s a small patch that can be applied to wp-cache-phase2.php, version 2.0.19 (and probably lower) that checks if the submitted comment was moderated or not. You’ll also find wp-cache-phase2.txt below. Just rename that to .php and copy it into your plugins/wp-cache/ folder for it to work.

Remember to update WP-Cache too. Despite last year’s date on the above post, it was updated as recently as last month!

Download

  1. wp-cache-phase2.diff
  2. wp-cache-phase2.txt

Patch will be on it’s way to gallir in a few moments but if you’re using WP-Cache this could be a big help to your site. (and if you use Ultimate Tag Warrior I hope you’re using my patch?)

BarCamp in the Sunny South East

News from Keith is that plans are underway for a BarCamp to be held in Waterford sometime early in the new year. After their positive experience at the BarCamp in Cork, he and Tom Corcoran are planning it, and they can make available, “the facilities of the WIT centre in Carriganore – a superb building situated on its own campus.” Sounds good!

Plans are at an early stage yet, but I think I’ll be able to make the drive there for the day. I haven’t been to Waterford in ages and it’ll be nice to see the place again. Would anyone like to hear about WordPress, WordPress MU or WordPress.com? I’m not saying I will, but maybe …

Check out the Wiki too. That will probably have the most up to date information.

Jason's Custom CSS for WordPress MU

Many moons ago, Jason’s Customciser was released onto an unsuspecting WPMU forum. It’s a small plugin that allowed one to change the value of some of the CSS elements in a theme’s style sheet.

Before you get too excited, it’s in rather a raw format, can cause problems and needs work to be usable. The original plugin used some PHP5 conventions and functions which limited the audience who could use it. I’m posting this because people are wondering where the PHP4 port I wrote disappeared to. It’s still here, but please link to this post instead of linking to the zip file.

Download Jason’s Customciser-doc – this plugin needs a lot of work to be usable. I’m not joking!

If you’re wondering, this is not the same plugin that is used on WordPress.com to allow editing of CSS files. I just wonder why someone doesn’t write a simple templating system in Smarty or something that loads through the traditional WordPress theme files? It’s a no-brainer. It may not be the most efficient way of doing it, but it’s one simple way.

Brians Latest Comments Cached

After the success I had with Ultimate Tag Warrior I turned my eye to another popular WordPress plugin that I use: Brian’s Latest Comments.

This plugin lists the latest comments on your blog and I wanted to squeeze every bit of performance out of my server so I guessed that caching the output of the plugin would save several queries for every page generation. Comments are cached for an hour. The cache isn’t invalidated by a new comment so don’t worry if the comments list doesn’t update immediately after a comment is made.

Install

I used the same cache directory that WP Cache 2.0 uses, wp-content/cache/. You’ll have to create that directory and make sure the webserver can write to it. The simplest way of doing that is by running the command chmod 777 cache. Download the file below and copy it into your plugins directory. If you’ve never installed the original plugin you’ll need to download it and read the install.txt to find out how to use the plugin.

Download

brianslatestcomments.txt – rename to .php and copy into your plugins directory.