Advertisement
Guest User

wpEmatico

a guest
Sep 19th, 2011
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1.    private function isDuplicate(&$campaign, &$feed, &$item) {
  2.     // Agregar variables para chequear duplicados solo de esta campaña o de cada feed ( grabados en post_meta) o por titulo y permalink
  3.         global $wpdb, $wp_locale, $current_blog;
  4.         $table_name = $wpdb->prefix . "posts";  
  5.         $blog_id    = $current_blog->blog_id;
  6.         $title = $item->get_title();// . $item->get_permalink();
  7.         $query="SELECT post_title,post_name,id FROM $table_name
  8.                     WHERE post_name LIKE '".sanitize_title_with_dashes($title)."%'
  9.                     AND ((`post_status` = 'published') OR (`post_status` = 'publish' ) OR (`post_status` = 'draft' ) OR (`post_status` = 'private' ))";
  10.                     //GROUP BY post_title having count(*) > 1" ;
  11.         $row = $wpdb->get_row($query);
  12.         trigger_error(sprintf(__('Checking duplicated title \'%1s\'','wpematico'),$title).': '.((!! $row) ? __('Yes') : __('No')) ,E_USER_NOTICE);
  13.         return !! $row;
  14.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement