Part of my blog broke…

Running the latest and greatest WordPress and K2 theme, I’m bound to run into trouble eventually…after returning from northern Minnesota, I manually ran my subversion script to bring things up to date. Things usually go smoothly after this process, but this time my sidebar gave me the business in the area where my latest comments normally appear.

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN ON comment_post_id = ID)) WHERE comment_approved = '1' AND .p' at line 3] SELECT comment_post_ID, post_title FROM ( LEFT JOIN ON (comment_post_ID = ID)) WHERE comment_approved = '1' and .post_status='publish' AND comment_type<>'pingback' AND comment_type<>'trackback'. ORDER BY comment_date DESC;

I figured that K2 was the culprit, as I’ve got the default widget sidebar (no widgets) going right now. I start poking around and discovered that K2 automagically uses Brian’s Latest Comments if it’s present. So the problem is with the BLC plugin and not K2 after all. That’s a relief. Now’s the time to hold your horses. What else changed when I ran my subversion script? I know I’m using WordPress 2.1 alpha so maybe something there has been altered. I also saw that .post_status in the database error and noted that it was unusual…shouldn’t be that way. So in looking at the SELECT query statement in BLC, it was choking on the $tableposts global.

I jumped over to Trac at WordPress and found ticket 2524 which was titled “$table* global variables sheduled for deletion.” Well that explains everything now. No wonder it was choking. I’d been deprecated. Well, at least $tableposts and $tablecomments had been!

Some quick work of changing some stuff up with the plugin and I was back in business.

My new global line: global $wpdb; Any instance of $tableposts was replaced with $wpdb->posts and similarly, $tablecomments with $wpdb->comments.

What does this all mean? It means that a slew of plugin authors will have to make sure their code is all squared away with 2.1 — probably not a big deal, but there you have it.

About Schulte

Darrell Schulte knows enough be dangerous, but so far hasn't messed anything up (too badly).
This entry was posted in WordPress. Bookmark the permalink.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>