Fixing the YOURLS plugin so it works under WordPress 3.1
I upgraded to WordPress 3.1 at the end of February. Usually, there’s very little breakage, but this time the YOURLS WordPress to Twitter plugin (version 1.4.8) I’ve been using to automatically post a tweet with a shortlink using my dew.is short URL service broke, which was very annoying. I was able to turn turn on the Tweetly Updater plugin as a stop-gap measure, but it uses bit.ly and I really wanted to use my own dew.is.
Browsing through the comments on the author’s website, I came across one from someone else who had managed to track down what appears to be the offending code, so I thought I’d try it out.
I made the change to the code and tried a test post. While the tweet was sent out, it didn’t have the short URL.
Nuts.
So I tried re-entering my YOURLS password into the plugin setup and made another test post and was very happy to see that the tweet had a dew.is short URL in it.
Here’s the change I made to the yourls.js file in the res subdirectory in the plugin directory:
1: // On form submit, first reset all pwd fields
2: $('.y_submit').click(function(){
3: // The following line was commented out on March 5, 2011
4: // to make the plugin work under WP 3.1 (gpd)
5: // password_hide_all();
6: });
Specifically, I commented out the password_hide_all() function in line #5 in the snippet of code. (I also added a couple of comments to make it easy to find the code again in the event that this breaks something else.)
The plugin’s author has indicated that he’s going to look into fixing this problem, but if you can’t wait and decide to use this fix, be aware that it hasn’t been rigorously tested. YMMV.