WP-O-Matic Bug Fixes Round Up
July 16th, 2008I’ve run into quite a few issues in the latest 1.0RC3-7 release of WP-O-Matic. Here’s a round up of the bug fixes and addons you need to actually this potentially useful product useful!
Also, it includes a well known MySQL bug fix.
The well known MySQL bug fix is a fix for the following SQL errors,
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 ' feed_id = 1, hash = 178e9c301b4781e2c7248ed115802291995cd2b6'' at line 2 for query SELECT * FROM `wp_wpo_campaign_post` WHERE campaign_id = 1, feed_id = 1, hash = '178e9c301b4781e2c7248ed115802291995cd2b6' made by isDuplicate
And/Or
WordPress DATABASE error Unknown COLUMN 'hash' IN 'field list' FOR query INSERT INTO wp_wpo_campaign_post (campaign_id, feed_id, , post_id, hash) VALUES ('1','1','4300','9b79457042fd10a210da6110ecfdbed0ed1d45c9') made BY processItem
The problem is that MySQL doesn’t like the commas in the multiple where clauses. You need to edit wpomatic.php
Find the isDuplicate() function
function isDuplicate(&$campaign, &$feed, &$item) { global $wpdb; $hash = $this->getItemHash($item); $row = $wpdb->get_row("SELECT * FROM `{$this->db['campaign_post']}` WHERE campaign_id = {$campaign->id}, feed_id = {$feed->id}, hash = '$hash' "); return !! $row; }
and replace with
function isDuplicate(&$campaign, &$feed, &$item) { global $wpdb; $hash = $this->getItemHash($item); $row = $wpdb->get_row("SELECT * FROM `{$this->db['campaign_post']}` WHERE campaign_id = {$campaign->id} and feed_id = {$feed->id} and hash = '$hash' "); return !! $row; }
Here’s the previous fixes.
Wordpress WP-O-Matic Duplicate Posts Fix
This is my modified wpomatic.php file -> Direct Download
| Bookmark it del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Propeller | Yahoo |
Tags: campaign id, database error, Download, Duplicate, getItemHash, hash values, mysql server, sql errors, sql syntax, WP-O-Matic
Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the PHP, Wordpress category.