I would like to import users via feeds and have the unique target be a profile field, not e-mail or username, because in the source data those elements may change. If either changed then the user wouldn't be replaced, but a new one would be created.

I'm not sure about all that would be needed to make this happen, like if requiring a profile field to be unique (http://drupal.org/sandbox/vrun/1173080) needs to be in place beforehand, or if feeds could just offer the option in the mapping settings on any profile field.

Any advice on how I might move forward would be welcome.

Comments

tommyk’s picture

Is there anything I would need to do besides add the line for 'optional_unique' => TRUE, (like I have done) to the code below in the profile.inc file? It makes the "unique target" checkbox show up for a profile field…

/**
 * Implementation of feeds_user_processor_target_alter().
 */
function profile_feeds_user_processor_targets_alter(&$targets) {
  if (module_exists('profile')) {
    $categories = profile_categories();

    foreach ($categories as $category) {
      $result = _profile_get_fields($category['name']);
      while ($record = db_fetch_object($result)) {
        $targets[$record->name] = array(
          'name' => t('Profile:'. $record->title),
          'description' => t('Profile:'. $record->title),
          'optional_unique' => TRUE,
          'callback' => 'profile_feeds_set_target',
        );
      }
    }
  }
}
twistor’s picture

Issue summary: View changes
Status: Active » Closed (outdated)