Reviewed & tested by the community
Project:
Feed Element Mapper
Version:
6.x-1.0-beta12
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Feb 2009 at 16:25 UTC
Updated:
12 Sep 2009 at 20:13 UTC
Jump to comment: Most recent file
Comments
Comment #1
alex_b commentedI assume this patch applies to 6.x just as to beta 4.
Comment #2
xmattus commentedYes -- should be drop-and-go for any version.
Comment #3
TKS commentedI get two iterations of the following warning when I drop this in as feedapi_mapper_userreference.inc:
Also, no user-reference option appears in the mapping-target pulldown.
I'm working with 6.x-1.0-beta12. Has something changed that requires a tweak to this .inc file? Or is $field_name variable -- which appears to be argument three on line 20 -- getting lost/not created/whatever elsewhere?
Happy to help test this addition -- and it'd be hugely useful to us! -- but I'm not sure where to start on fixing it.
Thanks
Comment #4
TKS commentedUPDATE: Found mention of the same warning in http://drupal.org/node/224235, and -- per alex_b's suggestion in http://drupal.org/node/224235#comment-1734770 -- updated line 20 to match the example in feedapi_mapper.api.php to:
That gets rid of the warnings, but I still get no mapping option.
I'm guessing that there were API changes for the ($op == 'list') and/or ($op == 'map') portions too, but the logical changes there aren't nearly as obvious to me as line 20 was.
Comment #5
xmattus commentedUpon inspection, it seems a number of things about hook_feedapi_mapper have changed since beta4, including which parameters are passed in. I've retooled this mapper according to the main CCK mapper, so hopefully it works for you. Give it a whirl and let me know. (Same filename caveat applies -- it should be named feedapi_mapper_userreference.inc)
Comment #6
xmattus commentedComment #7
xmattus commentedTo clarify -- the function has to return some different stuff than it did before (namely an array rather than a boolean), so that explains you not seeing the user ref option.
Comment #8
TKS commentedJust imported about 200 nodes as a test, and xmattus' revised .inc file (from comment #5) works flawlessly for me.
I was parsing in taxonomy terms -- we have an "author" vocabulary on our current D5 site, and are moving to a user-reference structure in D6. Those terms match usernames that we've already created in the D6 site.
One important thing to note: If there's a name that doesn't match -- for example, a former staffer for whom we neglected to create a user account on the new site -- the parser just ignores it. That's ideal, IMHO, as you don't want the mapping to choke on that, and it would be kinda crazy to attempt to create new accounts on the fly. I just mention it here for others who may want to use this.
Comment #9
xmattus commentedThat is correct, only extant users are matched by this mapper. It would actually not be terribly complex to create user accounts on the fly, but it requires some assumptions about what the default email address and such would be when it is not known otherwise. As this would be a more "extreme" behavior, I leave it to anyone who needs said behavior to customize further.
Comment #10
xmattus commented