diff --git a/CHANGELOG.txt b/CHANGELOG.txt index aaef7f307db625eb6da4268ffb15b728dc3f43d4..71dcf73c65f66db811d88181aa8dd608fbc44227 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 114dd6bcfce20e05e3ed02e76b6ff0ac1a4a5d70..c85c2d8a78b901ff286ecaa30c02bff35738d504 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;