Make Alex King’s Share This Plugin Play Nice With Unwakeable

Fixed. Unwakeable 2.0 will include this fix.

My Unwakeable WordPress theme doesn’t play nicely with Alex King’s Share This WordPress plugin. When Share This is being used, the livesearch feature of Unwakeable doesn’t work in Internet Explorer 6 or 7. I’m willing to bet K2 has the same issue. I know for a fact that Redoable had this problem at one point.

Livesearch breaks because prototype.js gets loaded twice, first by Unwakeable, then again by Share This. Now, Share This uses the prototype.js that will be included in WordPress 2.1, located at wp-includes/js/prototype.js. We use a custom prototype.js file for Unwakeable. The prototype.js file in Unwakeable will still provide all the functionality needed by Share This.

The prototype.js included in Unwakeable is located at wp-content/themes/unwakeable-1.2/js/prototype.js.php. It has a .php extension because there’s some PHP code at the top that needs processed before doing anything else. The PHP code tells the browser to cache the prototype.js file, it also sends correct content-type headers so the browser knows it’s dealing with a javascript file after all is said and done.

I’ve spent a few days thinking of possible solutions that could be implemented from within Unwakeable. That’s not possible though, unfortunately. Well, it is possible, but would require filtering all the HTML output by WordPress before it’s sent to the browser so we could strip out the prototype.js included by Share This. Doing something like that would probably result in a fairly dramatic decrease in performance, so it’s not an option.

Fortunately, it’s extremely easy to modify Share This to not load prototype.js. Here’s what you need to do:

  1. Open wp-content/plugins/share-this/share-this.php
  2. Go to line 352:
    
    
  3. Delete all of line 352 (code above) and you should be left with this on line 351 to line 354
    print('
    
    
    ');
    
  4. Save share-this.php and upload it to wp-content/plugins/share-this/

That’s all there is to do to stop Share This from loading prototype.js. It sorta sucks having to ignore the prototype.js that’s already included with WordPress 2.1. I will probably start working on making Unwakeable work with the prototype.js included in WordPress 2.1.

Does anyone know if it’s possible to determine if a javascript file has been loaded, from within javascript? I ask because I think Share This will still load a second prototype.js, even if I make Unwakeable work with prototype.js from WordPress 2.1 (the one used by Share This already).

I imagine Alex will come up with a method to determine if prototype.js has already been loaded. Unless javascript won’t allow identical .js files to be loaded, in which case determining if prototype.js has already been loaded would be pointless. If that’s the case then I should be good simply making Unwakeable work with prototype.js from WordPress 2.1.

Sorry for the scattered thoughts, this has really been bugging me lately. Anyway, you should be able to make your livesearch work with Share This in Internet Explorer now. This probably applies to most K2 based WordPress themes, but I’m not sure.

WordPress 2.1 Release Candidate 2

WordPress 2.1 Release Candidate 2 is out, roughly two days after RC1 was released. I’ve been keeping up to date with 2.1 releases since beta 2. You can download 2.1 RC2 here.

The only plugin I’m having trouble with in WordPress 2.1 is the FlickrRSS plugin. Ultimate Tag Warrior also had problems with WordPress 2.1, although I didn’t experience any of them. Ultimate Tag Warrior wasn’t slightly broken, it was trashed, and would delete tags for posts. Here’s what the guys at NeoSmart had to say:

Ultimate Tag Warrior is completely broken with WordPress 2.1 and you can lose all your tags by upgrading to WordPress 2.1. In the more recent SVN revisions of WordPress 2.1, any time a comment is added, deleted, or unapproved, you lose all the tags for that particular post.

Thankfully, Christine, the Ultimate Tag Warrior author, has released a new version of UTW that’s compatible with WordPress 2.1 (I think). I believe the new release implements a fix that was published for the UTW/WP2.1 issue back in December. There still seems to be some speculation over weather or not version 3.1415926 of UTW fixes all the problems with WordPress 2.1. I never had any problems with UTW and WordPress 2.1, even with versions prior to 3.1415926. Sounds like the problem may be somehow related to Akismet from the discussion going on at the UTW forum.

WordPress 2.1 Release Candidate 1

WordPress 2.1 Release Candidate 1 is out. Ryan Boren has the details over on his blog. There’s a list of changes in 2.1 at the WordPress codex, as well as a list of plugins that are compatible with WordPress 2.1.

If you’re using WordPress 2.1 RC1, you can give feedback via the testers mailing list or at the forum for beta releases.

The WordPress developers are already thinking about WordPress 2.2. With 2.2 they’re gonna start doing time based releases, trying to release every four months:

With 2.2 we’re going to start doing time based releases. We’re going to try to do a release every four months and limit the scope of the changes to what we can realistically achieve within that timeframe. The goal is to get cool new features into user’s hands more often instead of saving them up for the one big release every year.

WordPress 2.1 MySQL Requirements

Ryan Boren posted about MySQL requirements in the upcoming WordPress 2.1 release. WordPress 2.1 will require MySQL 4.0, MySQL 4.1 won’t be required until WordPress 2.2 comes around. So, WordPress 2.1 will require at least MySQL 4.0 to function correctly. No more MySQL 3 people. If you’re still using MySQL 3, it’s far past time to upgrade.

MySQL AB discontinued support for MySQL 4.0 back in September, so it’s likely hosting companies will be upgrading to 4.1 within a year or so.

Also, WordPress 2.1 beta 3 is out, it’s running on this blog right now.