etruel / wpematico

11 stars 9 forks source link

Always same hash when no permalink in rss feed #54

Closed Canic closed 10 months ago

Canic commented 1 year ago

Hey,

we have a xml feed without a permalink. The feed has only a guid tag with isPermaLink=false and content inside like:

uniqid-of-post

Problem is now that all posts has the same hash ( NULL ).

Would it not be better to use on wpematico_campaign_fetch->processFeed() something like this:

if ($prime) {
  //with first item get the hash of the last item (new) that will be saved.
  $this->lasthash[$feed] = md5($item->get_id());
  $prime = false;
}

$this->currenthash[$feed] = md5($item->get_id()); // el hash del item actual del feed feed

Before the md5 has been generated from $item->get_permalink().

Need some more work to add this as a update because all of the current wpematico installations had then duplicate posts because of different hash source.

etruel commented 1 year ago

This may be a good thing to modify. We will keep it in mind to do some tests before the next version.