When I used this with a recent version of Feeds (7.x-2.0-alpha8+33-dev), the $values passed to callback is an array instead of a string.

Attached patch uses reset() to grab first item from $values array.
The example my_module_set_target() in feeds.api.php uses this same method.

Tested and now deployed on a site that imported a few hundred users using this module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

krisahil’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.28 KB
manuel_mra’s picture

I really wanna thank you with this patch.
I was trying many differents ways and using many time.
Thank you.

thatpixguy’s picture

Thanks! I needed to re-do an import I made a few months ago and was scratching my head wondering why it wasn't working :)

rcodina’s picture

Status: Needs review » Reviewed & tested by the community

Patch on #1 works for me too. I use Feeds 7.x-2.0-alpha8+84-dev.

I mark this issue as RTBC due to two previous comments and mine.

Thank you so much @krisahil. Let's hope mantainer commits this at some point.

retiredpro’s picture

Patched from #1 but still was not working for me.

I uploaded my images to sites/default/files folder but the import was not recognizing them. Instead, it was generating empty target picture files upon import.

Included is a patch that worked for me. I changed it to specify the default files folder as the source.

rcodina’s picture

@retiredpro Have you used the file mapper?

I think your patch is too specific. I show first patch again which is already RTBTC.

retiredpro’s picture

For some reason, my original reply attached twice and re-referenced the original patch.

@rcodina, I mapped my csv column name to the target User Picture. Is that what you mean? I couldn't find any information on where or how to specify where my source images were located. I assumed my source images should have been in /sites/default/files but it didn't seem to find it. Which is why i defined the default files folder as the source in my patch.

rcodina’s picture

@retiredpro You have to provide a full URL to your files. This is how it's meant to be used (like standart's feeds module's file/image mappers)

retiredpro’s picture

Thanks for the info, @rcodina.

rcodina’s picture

@retiredpro No problem

troybthompson’s picture

Has anyone gotten this module to work in the latest feeds, 7.x-2.0-beta1 ? I've tried the patches and I'm using full URLs, tried the tamper explode, and when I check file_managed I don't see the file there but with the wrong uid either. Anything I'm missing?

webservant316’s picture

The same problem observed here. I was able to get it working with a similar fix...

function feeds_user_picture_set_target($source, $entity, $target, $value) {
  //If not a valid URL or path
  $value = $value[0];
...

However, I am creating another issue, because this module is working properly to create new users through feeds, however, updates to existing users is causing the picture to be totally lost.

I am using feeds 7.x-2.0-beta1.

webservant316’s picture

Priority: Normal » Major

raising to major, since module is not functioning until this is fixed.

webservant316’s picture

any help here?

vistree’s picture

Same problem here. Only ways to solve: incluede #12 on your own or use tamper module to get string from array.

rcodina’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Related issues: +#1734398: Imported pictures incorrectly linked to importer instead of importee

You are right, this is not working on latest beta1 of Feeds. The patch on #15 on the related issue works for me on beta1. I close this issue as a duplicate.