I don't do patches, so sorry for this not being the right way.

Looks like line 122 misses round brackets around the condition statement. Works for me this way:

$node->type = (!empty($settings['content_type'])) ? $settings['content_type'] : variable_get('feedapi_node_type', 'story');

Originally:

$node->type = !empty($settings['content_type']) ? $settings['content_type'] : variable_get('feedapi_node_type', 'story');

Otherwise all nodes being created with the default "story" content/node type.

Comments

slizardo’s picture

I have the same problem, but I tried to use gemini's code but that doesn't solved the problem. ALL the nodes are always created of type "story".
If I hardcode the $node->type value to the want I need, then everything works ok.

I'll really appreciated you help.

gemini’s picture

Status: Needs review » Active

@slizardo: I'm afraid you may be correct. I don't know what exactly goes wrong, but looks like the default node type being picked up on the submission of the feed. I've been experimenting with the same feed so many times - submitting, deleting nodes, refreshing and at some point it just started working. Of course that point was when I began messing with the module file. So, I guess it was just a coincidence.

aron novak’s picture

Assigned: Unassigned » aron novak
Category: bug » task
Priority: Critical » Normal

Well, i would like here to explain the two-layer configuration system. I think this is the issue that you think FeedAPI should behave in one way, but the developers think another way :)
So, content-types have per-processor settings. Feeds also have per-processor settings. If you modify per-processor settings, the per-feed settings are not modified (because maybe you altered the settings...). So I assume you create a feed and then modify the content-type settings. But in fact you should modify the feed settings itself at node editing and set the feed item's node type.
Unless some of you tell me that i'm wrong and you really know how feedapi configuring works and feedapi is buggy, i mark it as a task: it should be documented somewhere.

gemini’s picture

Thanks for the quick reply Aron!

In my settings, both, content-types and the feeds have the same options checked and the "news" content type is selected in both.

I played a little bit more with the settings and found out that when I have content-type and the feed during creation set to "Refresh feed on creation" and "Update existing feed items" - all feed items are being created as "story" content-type. When I have those options unchecked and refresh feeds manually - all nodes are created in the correct content-type, which in my case is "news".

What do you think?

aron novak’s picture

Category: task » bug

It was a bug in the settings handling, i fixed it. Thanks for describing the problem so verbose, so i could spot it.

aron novak’s picture

Status: Active » Fixed
gemini’s picture

I'm glad it helped :) Thank you very much Aaron!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

TheZach’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Active

This error is poping up again, i just made sure I'm running the latest modules and things. I'm trying to get some further testing done

TheZach’s picture

Item was duplicated

http://drupal.org/node/235154

aron novak’s picture

Well, i could not reproduce the problem, your description is too short. Please provide me the following infos:
- which parser do you use?
- Do you use the FeedAPI-created default content-type or something else for creating feeds?
- Have you run the simpletest (http://drupal.org/project/simpletest) tests of FeedAPI? If not, please run feedapi tests and copy-paste here if there are errors.
- Please copy the row from variable table where the name is feedapi_settings_<>
Thanks in advance!

TheZach’s picture

FeedAPI Aggregator basic functions: Refresh a feed and find out if it's okay. Uses Common Syndication Parser for parsing and downloading.
[role] created name: simpletest_vyrW, id: 3 at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 278] OK
[role] created permissions: administer feedapi, advanced feedapi options, administer nodes, access news feeds, create aggreg_simpletest_kXyE content at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 282] OK
[user] name: simpletest_liNL pass: jc3JUWrQjQ created at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 312] OK
[browser] GET http://www.aspieweb.net/user at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 107] OK
[browser] Setting name="simpletest_liNL" at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 111] OK
[browser] Setting pass="jc3JUWrQjQ" at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 111] OK
[browser] POST by click on Log in at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 125] OK
[login] found name: simpletest_liNL at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 343] OK
[login] not blocked at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 344] OK
[login] not reserved at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 345] OK
[browser] GET http://www.aspieweb.net/node/add/aggreg_simpletest_kXyE at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 107] OK
[browser] Setting feedapi[feedapi_url]="http://novaak.net/rss.xml?simpletest_YfjB" at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 111] OK
[browser] POST by click on Submit at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 125] FAIL
The node is created. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 49] FAIL
The feed node is in the database at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 53] FAIL
The feed can be loaded. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 55] FAIL
The source's page is empty before refreshing. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 64] FAIL
The proper number of items were created. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 68] FAIL
The third news title can be read at the source page. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 71] FAIL
The proper number of items can be found in the database. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 75] FAIL
All the news items are deleted from the database. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 84] OK
The content-type's setting variable is successfully deleted. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_aggregator/feedapi_aggregator.module.test line 94] OK
Unexpected PHP error [Invalid argument supplied for foreach()] severity [E_WARNING] in [/home/content/z/l/a/zlassiter/html/modules/node/node.module line 521] EXCEPTION
Unexpected PHP error [implode(): Bad arguments.] severity [E_WARNING] in [/home/content/z/l/a/zlassiter/html/modules/node/node.module line 525] EXCEPTION
Unexpected PHP error [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE ] severity [E_USER_WARNING] in [/home/content/z/l/a/zlassiter/html/includes/database.mysql.inc line 172] EXCEPTION
FeedAPI Node basic functions
23 passes, 9 fails and 6 exceptions.
FeedAPI Node basic functions: Refresh a feed and find out if it's okay. Uses SimplePie parser for parsing and downloading.
[role] created name: simpletest_eX9I, id: 4 at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 278] OK
[role] created permissions: administer feedapi, advanced feedapi options, administer nodes, create feedapi_node_simpletest_zrZA content at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 282] OK
[user] name: simpletest_pkdv pass: ruaAQZoAMm created at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 312] OK
[browser] GET http://www.aspieweb.net/user at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 107] OK
[browser] Setting name="simpletest_pkdv" at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 111] OK
[browser] Setting pass="ruaAQZoAMm" at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 111] OK
[browser] POST by click on Log in at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 125] OK
[login] found name: simpletest_pkdv at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 343] OK
[login] not blocked at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 344] OK
[login] not reserved at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 345] OK
[browser] GET http://www.aspieweb.net/node/add/feedapi_node_simpletest_zrZA at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 107] OK
[browser] Setting feedapi[feedapi_url]="http://novaak.net/test_feed.rss?simpletest_qXKd" at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 111] OK
[browser] POST by click on Submit at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 125] FAIL
The node is created. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 48] FAIL
The feed node is in the database at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 52] FAIL
The feed can be loaded. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 54] FAIL
The proper number of items were created at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 63] FAIL
The first news item is a story. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 82] FAIL
All news items have the same type. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 83] FAIL
All news item titles are longer than 0 character. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 86] FAIL
All news item bodies are longer than 0 character. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 87] FAIL
All news items has the proper author. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 88] OK
All news item database entries are deleted because of feed deletion. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 97] OK
All nodes belonging to a news item are deleted. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 101] OK
The block is showing up at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 123] OK
[browser] GET http://www.aspieweb.net/node at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 107] OK
[browser] Setting url="http://novaak.net/test_feed.rss?simpletest_wJNH" at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 111] OK
[browser] POST by click on Add at [/home/content/z/l/a/zlassiter/html/modules/simpletest/drupal_test_case.php line 125] OK
The node is created via the simplified form block. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 131] OK
The feed node is in the database at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 135] OK
The feed has sane default values in the database table at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 144] OK
The content-type's setting variable is successfully deleted. at [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 158] OK
Unexpected PHP error [sort() expects parameter 1 to be array, null given] severity [E_WARNING] in [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 84] EXCEPTION
Unexpected PHP error [sort() expects parameter 1 to be array, null given] severity [E_WARNING] in [/home/content/z/l/a/zlassiter/html/modules/feedapi/feedapi_node/feedapi_node.module.test line 85] EXCEPTION
Unexpected PHP error [Invalid argument supplied for foreach()] severity [E_WARNING] in [/home/content/z/l/a/zlassiter/html/modules/node/node.module line 521] EXCEPTION
Unexpected PHP error [implode(): Bad arguments.] severity [E_WARNING] in [/home/content/z/l/a/zlassiter/html/modules/node/node.module line 525] EXCEPTION
Unexpected PHP error [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE ] severity [E_USER_WARNING] in [/home/content/z/l/a/zlassiter/html/includes/database.mysql.inc line 172] EXCEPTION
Unexpected PHP error [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT COUNT(*) FROM node WHERE nid IN ()] severity [E_USER_WARNING] in [/home/content/z/l/a/zlassiter/html/includes/database.mysql.inc line 172]

TheZach’s picture

http://drupal.org/node/231472

Was this fix part of the March 13th release?

aron novak’s picture

Status: Active » Fixed

I fixed some bugs in feedapi 5.x-1.x dev. I assume your problem was because of this bug: http://drupal.org/node/236863
Now it's fixed. Please make sure that this fix really solved your problem. (wait for the next daily dev build or fetch the latest code from the CVS) If it does not help, please reopen the ticket, but be more informative. You only copy-pasted here the output of simpletest tests. I asked another information too (http://drupal.org/node/207773#comment-772631)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.