by jesse

Today it came to my attention that the feedwordpress plugin we use to aggregate Zhenechs Feed was broken. Apparently since the upgrade to Wordpress 2.11. So I went to ask google about it and found a lot of people who have the same problem. The Thread at wordpress.org was closed a bit too early in my opinion. A bit later I found a guy who even sent an email to Rad Geek, the developer.

It was when I read his blog post, that I realized that I have to fix it by myself *sigh*

Ok, here we go.
In the latest feedwordpress package (0.98) there was a rss-functions.php in the OPTIONALS. Quick diffing shows: 0.8wp is still higher than 0.5 which is provided in wp-includes/rss.php (since a few versions, 2.0 i guess). So I copy it and overwrite the rss.php. Now to the code.

Reading about the fix in the thread, I take a look at the require_once calls in feedwordpress.php.

require_once (ABSPATH . WPINC . '/rss.php');

Yep, we just checked that.

require_once (ABSPATH . WPINC . '/registration-functions.php');

Change to:
require_once (ABSPATH . WPINC . '/registration.php');

Ok, sweet, but I still get this freakin MySQL syntax 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 ‘ORDER BY cat_id’ at line 1]
SELECT cat_id, cat_name, auto_toggle FROM ORDER BY cat_id

Back to the code:
$results = $wpdb->get_results(”SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id”);

$wpdb->linkcategories is empty. Not good.

Thanks to quickonlinetips.com - which, no offense, sounds more like a trojan spider page than the neat helper that it has gracefully been to me when I was desperate - I quickly found out that “Developers using the former linkcategories table should be aware that link categories are now part of categories.”

Umm, okay. So I replace every ->linkcategories with categories. I have to take out auto_toggle because it doesn’t exist anymore. I have no time to look into it further, whether it’s an option or not so I just leave it behind for now.

$results = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->categories ORDER BY cat_id");

I also commented the following lines out:
# if ('Y' == $row->auto_toggle)
# echo ‘ (auto toggle)’;

Now clap your hands: back to the dashboard, reconfiguring the feeds and, as far as i can tell, it’s working :)
The Options - Syndication page is still a bit screwed, but that could be an issue with spotmilk admin theme.

Complete Code: feedwordpress0.98-wp2.1fix.phps

Edit (08.02.2007):
I’m currently working on a fix for those of you who still encounter sql error. Please contact me to provide some debug informations:

via IRC:
Server: teranetworks.de
you’ll automatically join #woot

I’ve also set up a temporary email adress: feedwordpress@trashmail.net

Write an email and I’ll get back at you with my real email adress or via a messenger.

Edit2 (11.02.2007):
If you’re working with a clean wordpress 2.1 installation you have to comment a few more lines out (show_images=’N', show_description=’N', show_rating=’N', show_updated=’N', sort_order=’name’), that’s why some of you had this sql errors:

INSERT INTO wp_categories SET cat_id = 0, cat_name=’Contributors’, show_images=’N', show_description=’N', show_rating=’N', show_updated=’N', sort_order=’name’

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 'ORDER BY link_name' at line 1]

SELECT * FROM wp_links WHERE link_visible = ‘Y’ AND link_category = ORDER BY link_name

I updated the feedwordpress.phps, so grab it and try it out. It worked on a clean test install for me. Thanks to ryan from koesuma.com for pointing this out!