Importing users into node profiles

Events happening in the community are now at Drupal community events on www.drupal.org.
ghankstef's picture

I am using usernode, nodeprofile and nodefamily on a a site. I am trying to import users from a csv file. I used the user import module to imort users into the users table where they have a user name, email address and uid.

Now I want to write a script to import information into their node profile. I have a cck content type called member_profile in a table called content_type_member_profile.

So I am trying to figure out which tables I need to insert the data into to avoid having to enter hundreds of users

It seems to me that I need to insert data into these tables: node, content_type_member_profile, usernode, node_family

So say for example I have user John Doe with uid 19 imported with the userimport module
usernode creates a row in the node table with nid: 35 uid: 19 type: usernode title: JohnDoe

I create a row in the node table with uid: 19 type: member_profile title: JohnDoe and a nid of 67 is created

so I create a row in the node_family table with parent_id: 35 child_id: 67

I insert a row into the cck table member_profile with nid 67, vid 67 and other columns filed out

No love - what did I miss?

Comments

Devel module to the rescue!

ghankstef's picture

Using the devel module I was able to see I needed to insert a row into the node_revisions table too

You can look at this great

yched's picture

You can look at this great Lullabot article for a detailed view of CCK's table structures :
http://www.lullabot.com/articles/an_introduction_to_the_content_construc...

Then you'll need to relate the 'nodeprofile' node you created to your user / usernode. Not in front of my db right now, so I can't say for sure, but you might want to look at the 'usenode' and 'nodefamiliy' tables.

Export and inport user profile data

faqing's picture

I use Profile (Drupal 5 core module) to create contact fields. Now there are more than 20 fields. Now I want to export to another site. Are there any ways to export and import profile fields?

Any help or hints will be appreciated.
Thanks

did you write any script for this?

frost@drupal.org's picture

i've got to do something similar with a site, do you have any code i could have a look at it for a headstart of how to do this?
thanks!

user_import patch to do this all at once

smokris's picture

I just posted a patch to user_import adding support for nodeprofile --- so one can choose fields to map from CSV into nodeprofile CCK fields as part of the standard user_import interface.

node profile integration

robert castelo's picture

User Import 5.x-2.0-x now supports node profile integration.

Importing dates doesn't work yet, and importing into text fields whose widget is set to list requires a workaround (set field to text before import then change it back to list after import).

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: