WordPress MU 2.7.1 beta 2

WordPress MU is a multi user or multi blog version of WordPress that can be used to run sites like WordPress.com.

The 2.7.1 release is very close now. I have just uploaded wordpress-mu-2.7.1-beta2.zip for your enjoyment.

2.7.1 has taken longer than usual to come out, mainly because of the large number of bug fixes and new features in this release. Highlights include:

  • A revamped plugin system thanks to Andy Peatling. Plugins installed in the plugins directory rather than mu-plugins can be activated and deactivated on all blogs with one click.
  • The admin bar settings can be customized by any user for each blog via the “My Blogs” page. The code here is still rough, and may not make it into the final release. Please help clean it up!
  • The site admin can now set a Global Dashboard blog for users who don’t have blogs. Those users will be added to this blog rather than the first one.
  • And many more bugfixes you can read about on the MU Timeline

I think this release is just about good enough to put on a production server, but test it first on a development server and backup your old install if you’re really paranoid. All I’ll guarantee is that this software will take up space on your server. I need your help to test it.

If you’re a jQuery fiend or CSS styling guru, your help with the “My Blogs” page would be very much appreciated. My ugly code hides settings that aren’t relevant, but the page isn’t pretty. Use Trac or contact me through this site if you have ideas or code to contribute.

I’m glad to say that once MU 2.7.1 does come out. Upgrading from 2.7 should be as easy as clicking the Upgrade button in the dashboard. I tried upgrading from 2.7 yesterday and my test server upgraded itself after 1 or 2 false starts.
‘Course, if you’ve modified core files (naughty!), those changes will be overwritten and you’ll have to manually upgrade.

Thanks to everyone who helped me with patches, code snippets, ideas and with ticket updates on Trac.

Three links for WordPress developers

  • WordPress Coding Standards. I used to be a big fan of the “curly bracket on it’s own line” but many years ago that was beaten out of me. Coding standards can be a subjective preference, but they’re very useful when reading code created by others.
  • Data Validation. It’s vitally important that the data your web application accepts is checked for any malicious code. The new $wpdb->prepare() function is something every WordPress plugin author should be using if they have to use the database directly.
  • WordPress Nonces. A nonce makes sure that a request you’re sending your blog was one you meant to send. Without a nonce, another site could have your browser load an image on it’s site pointing at your blog’s admin page to do an administrative task. You don’t want another site fooling your browser into doing something malicious do you? See Cross-site request forgery on Wikipedia for more.

If you write plugins for WordPress, please take the time to read through those pages above and learn how to use the security tools on offer. I know of at least one very popular WordPress MU plugin that doesn’t use nonces and I’ve only looked at the code of a couple of them. Most plugins don’t use $wpdb->prepare() yet as it was only introduced in recent versions of WordPress.

As a user of Free Software, you already know that “Free” doesn’t mean “Free as in beer”, it’s “Free as in speech”. If you know anything about software development help plugin authors by looking over their shoulders and checking their code. There is a cost to everything. In Free Software that cost is helping to test or fix bugs in the software you value and enjoy.

PS. WordPress MU 2.7.1 beta 1 is out, as is WP Super Cache 0.9.3 which has even more fixes for those running the latest PHP5 builds. Bloody register_shutdown() and it’s object destruction caused me no end of grief debugging that.

HOWTO: Make WordPress plugins work with WP Super Cache

Daffodil, snow and water droplets Thaya Kareeson has written an excellent article for plugin developers. It goes through how to make plugins work with WP Super Cache by using dynamic AJAX calls.

WP Super Cache can make static html copies of pages served by WordPress which is great for performance. Unfortunately that means some plugins don’t work because they rely on executing PHP on each request. The plugins need to be rewritten to use AJAX calls by the visitor’s browser. There’s a FAQ in the readme.txt all about it!

I previously wrote about adding AJAX to WordPress plugins but Thaya has worked through a simple example that will work perfectly with WP Super Cache. It’s a good foundation for plugin developers start from.

He also has versions of WP Postviews and Popularity Contest that have been rewritten to support static caching. I haven’t tried either plugin so leave a comment on his blog if you need help!

If you depend on a large portion of your content being dynamic this isn’t the solution for you as it will affect what search engines see. Those bots don’t speak Javascript, but for interactive purposes (ratings, stats etc) it’s the job.

reading glasses Further reading:

  • AJAX in Plugins is a must-read starting point for developers.
  • wp_enqueue_script() is the command WordPress uses to load Javascript files. That page links to a couple of good pages too including this best practices post. As of this writing, Thaya’s example don’t use wp_enqueue_script() but it’s simple to use.

The vast majority of plugins work just fine with WP Super Cache, but some of the ones that don’t are quite popular. If your favourite plugin doesn’t work, why don’t you help the author out and fix it? You have all the source code after all and you’ll be helping everyone else who uses the plugin!

WP Super Cache 0.9.1

WP Super Cache version 0.9.1 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

Major changes under the hood in this release, and many bugfixes:

  • If your blog is installed in a folder then compare the mod_rewrite rules in your .htaccess with those on the admin page. I fixed a bug in how those are generated.
  • Out goes the shutdown function the plugin relied on for years (going back to the days of wp-cache), and in comes plain old output buffering on it’s own.
  • If you’ve had problems clearing the cache on your blog it could be because wp-cron isn’t firing. I’ve added checks for that. Joost helped me debug that and he blogged about it too. You’ll get a nice warning message if those checks fail.
  • If after all that, your cache still doesn’t clear, add $wp_cache_shutdown_gc = 1; to wp-content/wp-cache-config.php to clear the cache at the end of pageload instead of by wp-cron. It will slow down page generation for a tiny number of your users though.
  • The Last and Next garbage collection times are now in the timezone selected for your blog.
  • Added an admin notice on the plugin page to warn that caching has to be enabled. A warning is shown below the plugin activation row too.
  • If your site runs on a Windows server, I fixed a small problem with slashes and creating the config file.
  • The plugin created empty supercache folders, but that’s fixed now.
  • Bad Behaviour support seems to work nicely now!
  • You can now relocate the supercache plugins folder. See $wp_cache_plugins_dir in wp-cache-config-sample.php.
  • I added 2 new filters: wp_cache_served_cache_file in wp-cache-phase1.php (BB uses this) and wp_cache_file_contents in wp-cache-phase2.php where you can filter the contents of the newly created cache before it’s written out to a file.
  • The readme.txt has been updated too warning about using NFS to store the cache folder, solving wp-cron problems, added the list of Apache modules required for expired pages to really expire in the browser cache.

I also added a donation link in the readme.txt and on the admin page. You can hide it with the click of a button but if you’re feeling generous, I’d appreciate a donation.
I don’t expect many donations, that’s how these things work, but if you tell me your site does 100,000 page views a day and you couldn’t live without caching I might be slightly annoyed if you come looking for free support.

PS. Looks like Bad Behavior support is broken because the docs on the BB site were a little misleading and I don’t use the plugin. Grab badbehaviour.php and copy into plugins/wp-super-cache/plugins/ overwriting the file of the same name in that folder.

WordPress and Blacknight power the best Irish blogs

grandad

Last Saturday night many of the Irish blogging community got together in The Cork International Airport Hotel for the Irish Blog Awards. I was there with my wife Jacinta, it was a great night and I was delighted to see so many WordPress powered blogs. Both WordPress.org and WordPress.com blogs were represented again and again among the top bloggers in Ireland.

I had planned on writing a post analysing the breakdown of WordPress vs Blogspot vs MT vs everyone else but lucky for me, Cathal Garvey already did the hard work!

pub

He has some very interesting stats on version numbers, and I’m shocked that “Best Technology Blog” (sponsored by Bitbuzz) has the worst record for upgrading WordPress. Hopefully this attention will encourage those bloggers to upgrade.

WordPress is the most popular blogging software among the Blog Awards nominees and Blacknight is by far the most popular hosting service. I don’t think you can get a better recommendation than that for either WordPress or Blacknight.

BTW – That’s Grandad in the photo above. Go read his blog, Head Rambles. You’ll love it!
PS. Here are the results of the Awards, read more by Red Mum, Robert, Niall and Jason who reminds us we should vote for the excellent Cork International Airport Hotel. TheChrisD has a massive post listing everyone in his feedreader who posted about the Awards, a few pics, and some of the videos shown on the night.
I’ll be uploading photos from the night in a post here and to Pixie later.

PPS. Alan Burke got in touch and asked me to give Drupalcamp Galway a plug. He added, “Maybe we could convert a few WordPress users ;-)” but of course that’ll never happen!

On Saturday 4th and Sunday 5th of April 2009 in Galway, 2 groups of Drupal developers will work on building 2 real working Drupal sites for 2 good causes. They will have 24 hours to complete their website. We are calling organizations, charities and NGOs from Ireland to submit their site proposal. Any organisation can register as long as they are not-for-profit and do not have a Drupal site already running. (A few static HTML pages is the limit for being accepted).

Sounds like a great idea and a worthy one too.

Ryanair Staff Give WordPress some lovin'

Oh yeah, a couple of Ryanair staff really love WordPress! Or maybe not. Jason Roe discovered that Ryanair’s website session handling isn’t 100% reliable. Click through to the voucher section, click back and suddenly the price of your flight is 0.00!

ra1

Unfortunately a few Ryanair staffers decided to take it upon themselves to chastise Jason for his blog post and took a dig at WordPress while they were at it.

You dont get a free flight, there is no dynamic data to render which is prob why you got 0.00. what self respecting developer uses a crappy CMS such as word press anyway AND puts they’re mobile ph number online, i suppose even a prank call is better than nothing on a lonely sat evening!!

Personally, I believe him about ryanair.com and the “dynamic data” which I presume is POST data, but they should handle these situations better. Their chief rival in Ireland, Aer Lingus show an “expired session” page at every wrong turn which is annoying but at least doesn’t lead me down the garden path of trying to buy tickets for €0.00!

Maybe Ryanair should hire Damien to give them a clue about how to play nicely online. Can’t see that happening though. They’d probably charge you €2+€5 credit card fee just to send them a refund request by tweet.

PS. Jason verified the IP addresses of the Ryanair staff. They were browsing blogs at work from their company’s designated IP range of 193.120.152.0 to 193.120.152.127.

The survivors guide to unemployment

jobless I like this. David Jones was recently laid off from his day job and decided to write a book about his experiences in the hope that it might help others in the same position. The book is called “Oh No: I’ve Lost My Job What Am I Going To Do?” and was written in just a few days.

Last week he was on Newstalk talking about his book when he was contacted by Maryrose Lyons from Brightspark Consulting who suggested that a website would really help his book. I’ll let Gordon continue, he’s one of the team who built the site:

Maryrose gathered a team together consisting of Rachel Earley (Website Graphic designer) , David McDonald (Book Graphic Designer), David Duignan (Photographer), Alex Gibson (Award winning Podcaster ) and myself to put the site together and make the functional stuff like Paypal work.

And so was born Joblessandproud.com. Today, for one day only, you can download David’s book for free. It’s only €4.99 anyway, a steal at that price.

It also has a blog, I’m glad to see powered by WordPress. I’m going to subscribe and see what David makes of this opportunity. It’s wonderful to see that WordPress is part of this venture.

Want to test the new WP Super Cache?

I need testers. Several people answered my call on Twitter last week to help test WP Super Cache. Here’s your chance!

Grab the development version and install it in your plugins folder as normal. Some of the new features and bugfixes to look out for:

  • If your cache files aren’t being deleted add “$wp_cache_shutdown_gc = 1;” to the config file, wp-content/wp-cache-config.php. The plugin will do garbage collection at the end of page load instead of using WP Cron. It’ll only fire off as often as before.
  • Empty supercache directories won’t be created now.
  • Bad Behaviour supported is added. Just enable the plugin at the bottom of the admin page.
  • If you’re getting an error “Call to a member function get() on a non-object in .. cache.php” that should be fixed.
  • Incorrect supercache mod_rewrite rules were generated if your blog was installed in a sub directory and they’re fixed now as well but you’ll have to delete the old rules.

If all goes well, WP Super Cache 0.9.1 will be released before the end of the week!

WordPress MU 2.7

After a lengthy delay, WordPress MU 2.7 is now available. WordPress MU is the software that runs on WordPress.com and many other sites.

This is a sync of the code from WordPress 2.7 released last December. It’s taken a while but I think it’s worth the wait as there are many bugs fixed. Besides the merge with WordPress 2.7 there are also a few new features, including Viper007bond’s admin bar which is the most user visible addition.
Check the timeline for further info.

Upgrading from WordPress MU 2.6.5 should be as easy as copying over your existing install but please backup everything. Blog databases must be upgraded but that will occur in the background as usual.

I would really like to thank everyone who helped me bring this release out and offered me encouragement along the way. I’d name names but I’m bound to miss someone! It’s great hearing what everyone is doing with WordPress MU. There’s quite a community out there!

WP Super Cache 0.9

WP Super Cache version 0.9 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

Update – if your blog is installed in a sub directory instead of at the root of your server, the .htaccess file might be wrong. Download and install the development version which corrects this. You’ll have to edit the .htaccess file (anyone want to volunteer to write an auto-upgrader?) and remove the rules between the lines # BEGIN WPSuperCache and # END WPSuperCache. Delete those lines too and visit your admin page. The plugin should do it’s stuff and spit out correct mod_rewrite rules for you. The dev version also has a few other bug fixes so if you’re adventurous have fun upgrading!
There’s no need to touch wp-content/cache/.htaccess

Are we nearing version 1? Possibly. In this release a number of bugs have been fixed and the following new features added:

  1. Mobile user agents are detected and a different cache page created for them. If you use a plugin that displays a different theme to these devices it will hopefully work now. The plugin changes to “half-on” mode because the detection is done by PHP. Thanks to Alex King‘s WordPress Mobile Edition plugin for the detection code.
  2. The number of cache files will be more than halved on a normal site with plenty of anonymous visitors. This should be a huge win for WordPress MU sites and very busy blogs.
  3. The last and next garbage collection times are displayed on the admin page now.
  4. In previous versions the newly generated page was delivered uncompressed to the first visitor even if the browser supported compression. I’ve fixed this but I’m not 100% certain it will work for everyone so it’s disabled by default. Edit wp-content/wp-cache-config.php and add “$wp_cache_gzip_first = 1;” to enable this. It’s enabled here.
  5. If expiry time is longer than 30 minutes, garbage collection will be done every 10 minutes, else it’ll be done 10 seconds after the expiry time.
cache-contents

Unfortunately wp-content/advanced-cache.php will have to be updated again and it’s not as simple as copying the file from the plugin directory. Full instructions are printed on the admin page and it should auto update in most cases.

PS. Test your upgraded blog on Is my blog working, a project by fellow Automattican Alex Shiels.
Here’s the page for this site. 102ms page generation time is rather fast!