? mappers/location.inc Index: feeds.api.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/feeds.api.php,v retrieving revision 1.10 diff -u -p -r1.10 feeds.api.php --- feeds.api.php 24 Feb 2010 01:19:33 -0000 1.10 +++ feeds.api.php 17 May 2010 17:03:07 -0000 @@ -108,6 +108,19 @@ function hook_feeds_after_import(FeedsIm */ /** + * Alter mapping targets for users. Use this hook to add additional target + * options to the mapping form of User processors. + * + * For an example implementation, see mappers/location.inc + * + * @param: &$targets + * Array containing the targets to be offered to the user. Add to this array + * to expose additional options. Remove from this array to suppress options. + */ +function hook_feeds_user_processor_targets_alter(&$targets) { +} + +/** * Alter mapping targets for nodes. Use this hook to add additional target * options to the mapping form of Node processors. * Index: plugins/FeedsUserProcessor.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsUserProcessor.inc,v retrieving revision 1.10 diff -u -p -r1.10 FeedsUserProcessor.inc --- plugins/FeedsUserProcessor.inc 28 Apr 2010 22:18:30 -0000 1.10 +++ plugins/FeedsUserProcessor.inc 17 May 2010 17:03:07 -0000 @@ -94,6 +94,26 @@ class FeedsUserProcessor extends FeedsPr } /** + * Loads on-behalf implementations from mappers/ + */ + protected static function loadMappers() { + static $loaded = FALSE; + + if (!$loaded) { + $path = drupal_get_path('module', 'feeds') .'/mappers'; + $files = drupal_system_listing('.*\.inc$', $path, 'name', 0); + foreach ($files as $file) { + if (strstr($file->filename, '/mappers/')) { + require_once("./$file->filename"); + } + } + // Rebuild cache. + module_implements('', FALSE, TRUE); + } + $loaded = TRUE; + } + + /** * Execute mapping on an item. */ protected function map($source_item) { @@ -188,6 +208,11 @@ class FeedsUserProcessor extends FeedsPr 'optional_unique' => TRUE, ); } + + // Let other modules expose mapping targets. + self::loadMappers(); + drupal_alter('feeds_user_processor_targets', $targets); + return $targets; }