[Plugin: WPeMatico] Checking for duplicates based on permalink rather than title doesnt work
-
I use WPeMatico 0.8beta to gather RSS feeds for events and save new posts as draft. On nearly every post we have to change the title and so on each new WPeMatico run the post gets imported again 🙁
I looked in wp-content/plugins/wpematico/app/wpematico_dojob.php and found on line 174 the following code:
private function isDuplicate(&$campaign, &$feed, &$item) { // Agregar variables para chequear duplicados solo de esta campaña o de cada feed ( grabados en post_meta) o por titulo y permalink global $wpdb, $wp_locale, $current_blog; $table_name = $wpdb->prefix . "posts"; $blog_id = $current_blog->blog_id; $title = $item->get_title();// . $item->get_permalink(); $query="SELECT post_title,id FROM $table_name WHERE post_title = '".$title."' AND ((<code>post_status</code> = 'published') OR (<code>post_status</code> = 'publish' ) OR (<code>post_status</code> = 'draft' ) OR (<code>post_status</code> = 'private' ))"; //GROUP BY post_title having count(*) > 1" ; $row = $wpdb->get_row($query); trigger_error(sprintf(__('Checking duplicated title \'%1s\'','wpematico'),$title).': '.((!! $row) ? __('Yes') : __('No')) ,E_USER_NOTICE); return !! $row; }So I tried to implement the duplicate check based on permalink, but I might have forgotten something, as the following code doesnt work – any help/hint is appreciated!
private function isDuplicate(&$campaign, &$feed, &$item) { // Agregar variables para chequear duplicados solo de esta campa?a o de cada feed ( grabados en post_meta) o por titulo y permalink global $wpdb, $wp_locale, $current_blog; $table_name = $wpdb->prefix . "posts"; $blog_id = $current_blog->blog_id; $title = $item->get_permalink(); $query="SELECT post_name,id FROM $table_name WHERE '".$title."' like '%post_name%' AND ((<code>post_status</code> = 'published') OR (<code>post_status</code> = 'publish' ) OR (<code>post_status</code> = 'draft' ) OR (<code>post_status</code> = 'private' ))"; //GROUP BY post_title having count(*) > 1" ; $row = $wpdb->get_row($query); trigger_error(sprintf(__('Checking duplicated title \'%1s\'','wpematico'),$title).': '.((!! $row) ? __('Yes') : __('No')) ,E_USER_NOTICE); return !! $row; }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
The topic ‘[Plugin: WPeMatico] Checking for duplicates based on permalink rather than title doesnt work’ is closed to new replies.