Drupal 6 to Drupal 7 Profile Migration

Working on the Raintree Village upgrade to Drupal 7 and came on the problem of migrating D6 Content Profile module profiles to D7 Profile2.

We are trying to move profile data from Drupal 6 nodes that are content types to Drupal 7 data in entities. There is no direct upgrade path so thanks to the insperation gathered here I was able to use VBO to move the data.

I already had a view set to show a table for the users with a total of 4 fields showing. In the view settings I added a "Bulk operations: User" field and checked the "Execute arbitrary PHP script" setting. This gives the ability to update the live view by using a script that's pasted in a text field. Checkboxes are provided for selection of which users to update or "All" can be selected.

This process works on fields that are in the node even if they aren't used in the view. Of course your Profile2 profile type is already set up if you have a view using it. Below is the code used in this project.