Now that Robert has set up User Import to import values into an associated Content Profile node, (see http://drupal.org/node/343795),
I've got new requirements that I'm working on.

1) For any of the fields that can take multiple values, I'd like to be able to specify a given import field multiple times to go to the same content profile field.

2) For any Node Reference field within a node associated with users using Content Profile, there are a variety of ways one might want to set the value for this field.
Rarely will one want to directly import the nid from the data file to drupal. Instead, I'd like to:
* have a value set for the NID if the imported field text matches the title of the node, and the node reference is configured to point to that particular type of Node
* have a value set for the NID if the imported field has a value of '1' in it to match the header of the CSV file to the title of of the node, as long as the node reference is configured to point to that particular type of node.

Items 1 and 2 should be able to work with eachother.

I've completed work for #1, and am getting close to getting #2 to work, I'll post patches when I've got something working.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chrispeat’s picture

Excellent news, how are you going with point #2?

Thanks

Chris

BenK’s picture

Subscribing and very interested....

DarrellDuane’s picture

Still working on this, I hope to have something in a week.

DarrellDuane’s picture

OK, I've got something working. I did a lot of hacking to the user_import.module as well as the content_profile.inc. Before I get a patch file all set up, if some brave souls want to download this version of the module and test it out that'd be great.

This version does both items 1 and both parts of item 2 above. You'll see new options for any fields in your content_profile CCK type when doing the import that allow all of this to happen. Content Profile is now abbreviated (CP) here, and (M) indicates the field takes multiple values, so you can assign that field to multiple columns in your CSV file.

I also fixed a bug with error reporting where errors weren't being collected properly at the end of reading in each row of the CSV. I had to remove the function that saves the error to the database and put that code inline at the end 'cos I was getting an error about passing an Object through. I realize I didn't have to do this now, all I need to do was change $account['email'] to $account->email in the call to the function, so I'll clean that up later. This is at the end of _user_import_process() function

DarrellDuane’s picture

NOte also that this version of user import supports the functionality described in http://drupal.org/node/709968

DarrellDuane’s picture

Note also that I forgot to apply compression to the attachment in #4 so it is simply a tar file, it has not been gzipped.

DarrellDuane’s picture

FileSize
33.16 KB

The tarball in #4 doesn't work, but here is a patch that works very nicely. This also supports the functionality described in http://drupal.org/node/709968

There are updates to user_import/user_import.module
as well as user_import/supported/content_profile.inc and user_import/supported/user_import.inc

DarrellDuane’s picture

Status: Active » Needs review
DarrellDuane’s picture

Assigned: DarrellDuane » Unassigned
garbo’s picture

I have a solution for importing both users and their content-profile using the node import module. This way both node-reference and taxonomy fields can be imported!

The steps are (simple!)
1 first import the users through node import
2 import the content-profiles and here comes the magic part: at step 4 of the importing process (where you map the columns to their CCK fields) under "author information" you need to reference the author with their e-mail adress. This way the created profile is matched with the correct user!

I tried it and it works!!!
I hope this is usefull to anybody. Would love to see any reactions from people who tried it.

richardtmorgan’s picture

Thankyou for this. I had been struggling with the fact that the User Import module did not handle my node-reference field (which it doesn't - there's no way) and this has solved it.

As a slight twist on this solution - I brought the users (but not their profiles) in with the user_import module. This allowed me to create user names based on first names and household names - the user_import module is neat for this. I then imported the profile information (content_profile) with node_import, using the email field to identify the relevant user as described.

ianchan’s picture

subscribe

DarrellDuane’s picture

I'll work on getting a new patch of this for the latest release of User Import if people are interested.

Onfire60’s picture

subscribe

vonn.new’s picture

I did the same thing. I'm using Content Profile in D6.
User Import first, then Node Import of the Profile second.
In addition to importing the email address as author in step 4, you need to clear the authoring information (admin is default) in Step 5.
The node references came through great!

MrRedPants’s picture

Issue summary: View changes

I have users set up ( I believe using content profile). There are standard user fields, but I also have selectable fields from taxonomy.

I was testing out user import module and it works very well for the basics and I like it.
I can map certain fields in csv document to the taxonomy options, but, it doesn't "take"

In reading, there seems to be some combination needed of importing using node profile, content profile and / or user profile.

I have figured out importing through user profile and node profile, but, seemingly a missing element, importing content profile I can't figure out.

Can anyone lay this out more specifically on exactly HOW to accomplish this? By this I mean

Create a CSV file with user information, including first name, etc etc - basic fields, but ALSO fields that map to taxonomy choices for that user (in our environment the taxonomy choices are location, department, job title, etc).

Thank you!

gisle’s picture

Status: Needs review » Closed (outdated)

The Drupal 6 version is no longer supported.
There is no Content module in Drupal 7.
Closing as outdated.

gisle’s picture