From 10f18a2d6294d2ed3f4c5b4887b240eb0da184c0 Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Fri, 3 Sep 2010 21:44:03 +0000 Subject: [PATCH] #897258 TrevorBradley, alex_b: Mapping target nid. --- CHANGELOG.txt | 1 + plugins/FeedsNodeProcessor.inc | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index aaef7f30..71dcf73c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ Feeds 6.x 1.0 XXXXXXXXXXXXXXXXXX -------------------------------- +- #897258 TrevorBradley, alex_b: Mapping target nid. - #873198 BWPanda, morningtime: Import multiple values to tag vocabulary. - #872772 andrewlevine: Fix buildNode() (and node_load()) called unnecessarily. - #873240 thsutton: Use isset() to avoid notices. diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc index 114dd6bc..c85c2d8a 100644 --- a/plugins/FeedsNodeProcessor.inc +++ b/plugins/FeedsNodeProcessor.inc @@ -239,7 +239,7 @@ class FeedsNodeProcessor extends FeedsProcessor { $target_node->teaser = node_teaser($value); $target_node->body = $value; } - elseif (in_array($target_element, array('title', 'status', 'created'))) { + elseif (in_array($target_element, array('title', 'status', 'created', 'nid'))) { $target_node->$target_element = $value; } } @@ -264,6 +264,11 @@ class FeedsNodeProcessor extends FeedsProcessor { ); } $targets += array( + 'nid' => array( + 'name' => t('Node ID'), + 'description' => t('The nid of the node. NOTE: use this feature with care, node ids are usually assigned by Drupal.'), + 'optional_unique' => TRUE, + ), 'uid' => array( 'name' => t('User ID'), 'description' => t('The Drupal user ID of the node author.'), @@ -304,6 +309,9 @@ class FeedsNodeProcessor extends FeedsProcessor { // exist in the database. foreach ($this->uniqueTargets($source_item) as $target => $value) { switch ($target) { + case 'nid': + $nid = db_result(db_query("SELECT nid FROM {node} WHERE nid = %d", $value)); + break; case 'url': $nid = db_result(db_query("SELECT nid FROM {feeds_node_item} WHERE feed_nid = %d AND id = '%s' AND url = '%s'", $source->feed_nid, $source->id, $value)); break; -- GitLab