Friday, February 2, 2007

cordobo-green-park 0.9.3 BETA 4 error with WordPress 2.1


I upgraded to Cordobo Green Park 0.9.3 BETA 4 and WordPress 2.1.



After that I got the following error on a right sidebar:
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 '' at line 1]
SELECT cat_id, cat_name FROM

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 '' at line 1] SELECT cat_id, cat_name FROM



I searched the Internet and found the similar problem described and resolved (http://mu.wordpress.org/forums).



To fix the problem I modified WordPress/wp-content/themes/cordobo-green-park/sidebar.php the following way.
Replace

$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");

with

$link_cats = $wpdb->get_results("SELECT DISTINCT cat_name, category_id cat_id FROM $wpdb->categories INNER JOIN $wpdb->link2cat ON $wpdb->categories.cat_id=$wpdb->link2cat.category_id");



As far as I understand linkcategories table became obsolete in WordPress 2.1 and was dropped. I guess the fix is not compatible with WordPress 2.0.



If you know how to fix the error in a better way - please share with us.



Thank you.

No comments: