I'm been trying to come up with a mechanism to insert/update certain nodes in our Drupal system. When I try to do the field mapping in Feeds most of the fields are listed and selectable. But, for those fields which are defined as User_Reference fields, they ARE NOT listed in the target field list. I can find no other reference to this.

So, how does/can one map a csv field to a user_reference type field defined in a content type?


  • is this a one time import or do you need to import often?
    – uwe
    May 24, 2012 at 15:41

2 Answers 2


Did you try patch from this thread?

The patch is http://drupal.org/files/userreference-mapper-748582_0.patch.


My initial approach, would be to try the patch linked to by Maxime's answer, as it looks promising.

However, a more flexible approach would be to override the importing yourself. This may not be entirely appropriate for complete beginners to programming, but it will on the other hand be able to solve the most complex Feeds scenarios. I've done some fairly advanced imports this way.

First, install Feeds tamper. This module allows you to create temporary targets for arbitrary data. Map the source of you user-reference field onto such a target.

Second, create a module that Feeds will accept plugins from. The generics of implementing Feeds plugins is already well covered in the docs, so there's no need for me to repeat them.

Third, we need to tell the feeds processor do something useful with this data. This custom processor will do just that. Honestly though, I haven't checked exactly what a user reference array looks like, as I don't know when last I used that, and have no site to check it on.

class UserRefProcessor extends FeedsNodeProcessor {
  protected function map(FeedsSource $source, FeedsParserResult $result, $target_item = NULL) {
    // Perform all the regular mapping.
    $target_item = parent::map($source, $result, $target_item);

    $user_reference_target = $parser->getSourceElement($source, $result, 'id_of_temporary_target');

    $target_item->user_reference_field = array('und' => array(0 => array('uid' => $user_reference_target)));

And you should be good to go :) If the user_reference_field = line is appropriately adapted, this could work for any type of field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.