Import new users and their Profile2 fields from one CSV file

This Cookbook shows, how you import one CSV file into a Drupal 7 site, creating new users, each with Profile2 fields.

The trick is to create two separate migrations from one source. The first creates the users, the second creates the profiles.

The second migration connects up the profiles it creates with the users that now exist by mapping the source unique key, MID, to the user uid. This is achieved by applying the line
$this->addFieldMapping('uid', 'MID')
to the code.

Remark
The intention of this cookbook is, with detailed notes on this page and comments in the code to explain the function of each component of this migration as a working demo. For your first try use a fresh installed 'drupal 7 with default profile' and then start with step 1.

Subscribe with RSS Subscribe to RSS - sourceMigration