Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.