Posted from issue #240697

Se7enLC - March 31, 2008 - 11:36
looking in the db, it seems that the iid field of simplefeed_feed_item is not being filled in. It seems that the correct $iid is being saved into $form_state. The node is created using this line of code, which I assume is internal to drupal:

drupal_execute('feed_item_node_form', $form_state, $node);

There's no other mention of "feed_item_node_form" anywhere else in simplefeed, simplepie or drupal

Se7enLC - March 31, 2008 - 15:31
Another possible fix:

in the function "simplefeed_item_feed_parse" toward the end, "drupal_execute('feed_item_node_form', $form_state, $node);" is called. $node is supposed to contain the defaults and form_state should contain the per-feed-item parameters. As it turns out, the function is using the $iid from the node rather than from the form state.

I added the following line of code right before that function call:
$node->iid = $iid;

I now see the iid being filled into the database. Unsure yet how this will effect duplicate checking, but I am hopeful

EDIT: it seems that this change was a success. New items are being imported, but changed items are not being updated. This may be intentional behavior. I might make changes to drop and re-add changed feed items under the same number

@Se7enLC
Confirmed, I don't know if it is the Drupal way, probably not since the $iid is attached to the form-stated, so that would be the preferred method I suppose.
But that does not work, my iid in tha database stayed empty (drupal 6.2, simplepie 1.1.1 developement snapshot of simplefeed). Your $node->iid = $iid; worked like a charm.
This should be in a next release, or at least a working version of the preferred Drupal method.
Cheers

Comments

m3avrck’s picture

Hmm, this is a bit confusing to me.

$node = array('type' => 'feed_item', 'iid' => $iid);

$node is an array with info. Here you change it to an object and it fixes your problem?

Something seems screwy. Either an older version of PHP or something isn't making that array and object or vice versa.

I'm not sure of the proper fix because I can't reproduce it with PHP5.2 ... anyone have any ideas?

xiffy’s picture

FYI My PHP version is 5.1.6 so it's not that old and it's certainly not an PHP4 issue.
Considering your suggestion I'll investigate the array / object confusion and hope to see the light.

m3avrck’s picture

Status: Active » Closed (fixed)

Fixed now.