Archive for February, 2009

Wordpress Toolbar Plugin and Wordpress Prefixes: A Fix

BandaidFirst of all, that’s an awesome plugin that will allow your visitors to have a look at external links while retaining the ability to comment locally on your blog. Get it!

Unfortunately, if you have modified your Wordpress database prefix, for instance because you are using Wordpress MU or the Virtual Module, the toolbar will fail to display.

Here is my very modest fix that will make it work.

1. Open wordpress-toolbar/toolbar.php

2. Find, near the top of the file:

$resultset = $wpdb->get_results("SELECT * FROM wp_options where option_name in ('wordpress_toolbar_social','wordpress_toolbar_excludedomains','wordpress_toolbar_skin','wordpress_toolbar_custom')");

Replace with:

$resultset = $wpdb->get_results("SELECT * FROM {$wpdb->options} where option_name in ('wordpress_toolbar_social','wordpress_toolbar_excludedomains','wordpress_toolbar_skin','wordpress_toolbar_custom')");

3. That’s it!

If you enjoyed this post, make sure you subscribe to my RSS feed!


Fixing permissions after a Wordpress prefix change

Do not enterLet’s say that you renamed your Wordpress tables.
There may be several reasons for this. For instance, you installed Virtual Multiblog to support more than one blog with the same setup.

And now, you are facing the dreaded “You do not have sufficient permissions to access this page”
What to do, what to do?

Turns out, after some research, I found out that there is a proper procedure for us lazy webmasters:

1. Download the force-upgrade script and run it. It’s a fairly old script but since it all it does is invoke Wordpress’ upgrade mechanism, it still works very well with 2.7. I know, it’s not an upgrade! But you can also run the script to right some wrongs…

2. Using your favourite SQL editor, edit the “usermedata” table. Let’s say that your old table prefix was ‘wp_’ and your new prefix is ‘wp_new_’ you would type this simple SQL command to make sure that your first user is still admin:

 update wp_new_usermeta set meta_value='a:1:{s:13:"administrator";b:1;}' where meta_key='wp_new_capabilities' and user_id=1;

You’re all set.

If you enjoyed this post, make sure you subscribe to my RSS feed!


Chris’ Weekly High-Protein Tweets

If you are drowning in Twitter updates or simply missed a few of my Tweets, here is a list of what I consider worth reading this week.
By that, I mean that less interesting, personal and topical tweets are not in this list. This list will be published every week, save the occasional attack of laziness.

Upt-to-date: a jQuery 1.3 cheat sheet http://bit.ly/rqpI
So you want to write a Photoshop killer – four pro users’ wishlists: http://bit.ly/yBoN
Mike Chambers’ free iPhone app: ActionScript 3 reference manual http://bit.ly/UBci
A KDE lesson: there is a difference between management decisions and engineering ones: http://bit.ly/3DAks
Of course major version of PHP are slow to adopt: its success relies on being the path of least resistance! http://bit.ly/10Mf7
Awesome: Ketchum teaching Fedex about social media while failing miserably on Twitter: http://bit.ly/wUul
Tweepler: Interesting, but a 10 minutes intro video? Really, guys? http://bit.ly/eAFq
jQuery 1.3 Sizzle performance: oh-my! http://bit.ly/14UvB
Javascript Namespace pollution results — Worst offender: MochiKit — Good citizen: Spry — http://bit.ly/2n8J
Insanely beautiful screensaver for OS X: http://bit.ly/15Vzx

If you enjoyed this post, make sure you subscribe to my RSS feed!