I agree with you. This could be a great plugin, if developers do some minor jobs.
“During fetching, if the Plugin find the same Post than it breaks without to jump to the next one”
I checked the plugin, and when it loop through the items in the feed, if it found 1 duplicate, it jump out from the cycle, so if your first article is a duplicate, you lose, and items wont imported after that.
I also checked the count of max items should be fetch, and here are another error also. If you do not set anything for that field, or that limitation is zero, it break out from cycle too.
With 5 minutes work, i made my workaround, and now the plugin is working like a charm.
If you want to fix it do the following (i hope you will understand).
Open the campaign_fetch.php:
In the “private function processFeed” method, find the first foreach cycle:
Now i am working on the date of post, because that isn’t correct too.
$simplepie = WPeMatico :: fetchFeed($feed, false, $this->campaign['campaign_max']);
foreach ($simplepie->get_items() as $item) {
Right after the foreach line insert this line:
$duplicated = false;
Find these lines in this method:
trigger_error(__('Filtering duplicated posts.', WPeMatico :: TEXTDOMAIN), E_USER_NOTICE);
(These lines are appears two times).
And change it for this:
trigger_error(__('Filtering duplicated posts.', WPeMatico :: TEXTDOMAIN), E_USER_NOTICE);
$duplicated = true; //By MEDIAFEST
//break;
As you see, i inserted a new variable, called $duplicate at the begining of the cycle with a value false, and if the post is duplicated, i set it to true. Don’t forget to comment out the “break;” line. Break command is jump out from cycle. This was why plugin stops at the firs duplicate article.
Ok, so now we know, this is a duplicate content, so add a new condition after the checkings of duplicates.
Find thees rows:
$count++;
array_unshift($items, $item); // add at Post stack in correct order by date
What happens here? Incrase the count of valid items, and add this item to an array.
So, we should do it only if this item not a duplicated one.
So extend your code with this:
if (!$duplicated) {
$count++;
array_unshift($items, $item); // add at Post stack in correct order by date
}
As you see, here are a new condition.
Ok, but we do not finish yet.
After this line, find this:
if ($count == $this->campaign['campaign_max']) {
and change it to this:
if ($this->campaign['campaign_max'] != 0 && $count == $this->campaign['campaign_max']) { //Do it only if campaing max != 0
We check, is the setting of $this->campaign[‘campaign_max’] is zero or not. So if we have not set this setting, or set it to zero, do this count check, otherwise do not care about it.
I hope i could help you guys.