Closed (fixed)
Project:
Feeds
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 May 2012 at 10:02 UTC
Updated:
4 Aug 2016 at 14:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
hpbruna commentedComment #2
vcrkid commentedI tried it patching it manually (my version of FeedsUserProcessor.inc has already been patched a couple of times) but it didn't work.
The problem is that the initial code include didn't exist in the original file, i.e.
I played with it and found that I wound up with this and it worked.
You may want to verify the + signs as I'm just typing in everything manually.
The second part of the patch went it without any problem and it all worked out (as far as I can tell).
Thanks for the code, it's invaluable!
Comment #3
TheBarnacle commentedI just manually added this patch and it worked great. Thanks hpbruna and vcrkid!
Are there any plans to put this in the next release? I think it'd be a useful added feature.
Comment #4
twistor commentedThe patch does not currently apply, other than that, it looks good.
Comment #5
robcarrPatch as rolled against latest DEV (27 Sep 12)
Comment #6
firfin commentedMarked #1171456: Importing users with UID / Adding nodes with UID ownership? as a duplicate of this one.
Will try this patch out asap.
Comment #7
firfin commentedHeaven-sent!
Patch applied cleanly against 7.x-2.0-alpha7 with only minor line differences:
Hunk #1 succeeded at 53 (offset 3 lines).
Hunk #2 succeeded at 175 (offset 11 lines).
After clearing caches UID is available as a selectable target in the user processors mapping.
After using it as unique the UIDs get used for the new users.
One happy puppy here! Thanks aargh, vcrkid and hpbruna!
One question though, shouldn't the if statement in the beginning of entityValidate() be modified to check for UID also?
One more successful review and test by community.
Comment #8
bsevere commented#5 worked for me on 7.x-2.0-alpha7. This really helps, thanks!
Comment #9
timwoodMarking RTBC based on #8.
Comment #10
twistor commentedAwesome, looks great. We just need a test...
Comment #11
timwoodDo you mean a simpletest?
Comment #12
twistor commentedYesir.
Comment #13
sbakshian commented#5 worked for me too! Thanks very much :)
Comment #14
gaurav.goyal commented#5 Imports the users but does not give any error if some users are not imported, in my case i imported 7 users and the uid of 3 users were same, after import i got the message "Created 7 Users" and in actual only 5 users were created.
Comment #15
gaurav.goyal commentedPatch for #14
Comment #17
gaurav.goyal commentedSubmitting Patch Again for #16
Comment #18
gaurav.goyal commented#15: feeds-uid-mapping-1570544-15.patch queued for re-testing.
Comment #20
gaurav.goyal commentedFinal Patch
Comment #21
gaurav.goyal commentedComment #23
gaurav.goyal commentedAgain Submitting Patch
Comment #25
jannis commented23: feeds-uid-mapping-1570544-23.patch queued for re-testing.
Comment #27
st8ofmindz79 commented5: feeds-uid-mapping-1570544-5.patch queued for re-testing.
Comment #28
mjcarter commentedIn my case of needing to update existing users based on an input file mapped by UID, I mapped the UID column to the account e-mail address as a unique target, with this feeds_tamper_php script
The experimental entity importer added to feeds dev purports to allow UID mapped user imports - but it doesn't seem to work at all.
Comment #29
hectorelgomez commentedIt works.
Thanks.
Comment #30
paulraines commentedPatch 5: feeds-uid-mapping-1570544-5.patch above no longer works in the dev branch with all the new Entity stuff. You get SQLSTATE errors when trying to import new users about entity_id being null
Comment #31
francoud commentedAny idea about how to apply this patch to the latest -dev version? I really need this feature...
Comment #32
andrewsizz commentedAdded patch up to date
Comment #33
dang42 commentedJust applied #32 to 7.x-2.0-beta2 --> it worked.
Thanks!
Dan
Comment #34
andrewsizz commentedJust fix one typo in comment.
Comment #35
megachrizPatch looks okay, but an automated test is needed to get this in.
Comment #36
dang42 commentedHad to re-install feeds (my fault - not at all related to this patch...) then reapply the patch. Used #34 this time.
Worked flawlessly.
Comment #37
realgiucas commentedPatch 34 gives me this error for all the rows:
I'm sure the column in the csv file not null or empty
Any idea?
Comment #38
Collins405 commentedYep, same error as #37
Comment #39
megachrizI found an issue with the patch in #34 when creating new users. At first it reported a new user was created, but I didn't found this user. When trying to import an user with different details, I got the following error:
It seems as though that the anonymous user was updated, cause when I deleted all imported items, the anonymous user was deleted!
I fixed this issue by setting
$account->is_newinFeedsUserProcessor::newEntity().I also created a test for creating and updating users using the user ID as unique target.
@realgiucas, Collins405
I could not reproduce the error reported in #37. Can you check if you mapped your data correctly with the Feeds Import Preview module?
Comment #40
megachrizI have tried again to reproduce the error in #37 and this time I succeeded. The error shows up when mapping to user ID, but not using that target as unique target. So basically it wasn't possible to change the user's ID.
I've added some validation and a database update query so it becomes possible to change a user's ID. I've made it so that if an user ID is already in use the following message is shown instead of a sql error:
Comment #42
megachrizHm. The testbot apparently had a hickup. One test was failing first, and now passes. Back to "Needs review".
Comment #43
megachrizReroll.
Comment #45
megachrizI tested the patch once more and I found no more issues with it. I also verified that the anonymous user isn't updated when the uid in the source is
0and the user ID is marked as unique target. Putting in a negative user ID results into SQL errors, but I don't found it worthwile for Feeds to explicitly check on that. There could be a system that would allow negative user ID's (by implementinghook_schema_alter(), for example).Committed #43. Thanks all!