Index: email_registration.migrate.inc
===================================================================
RCS file: email_registration.migrate.inc
diff -N email_registration.migrate.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ email_registration.migrate.inc	7 Jan 2010 22:37:24 -0000
@@ -0,0 +1,38 @@
+<?php
+// $Id: email_registration.inc,v 1.1.2.4 2009/08/23 23:40:46 mikeryan Exp $
+
+/**
+ * @file
+ * Hooks to suport email_registration during user migration
+ */
+
+/**
+ * Implementation of hook_email_registration_name().
+ *
+ * If email_registration is in use, it overwrites any explicit username
+ * with one generated from the email address. Use hook_email_registration_name
+ * to short-circuit that and force the username set in the migration process
+ * (possibly randomly generated below).
+ *
+ * @param $edit
+ *  The values we passed to user_save().
+ * @param $account
+ *  The user account as created by user_save().
+ * @return
+ *  The username we've already set - returning this prevents
+ *  email_registration from overwriting it.
+ */
+function email_registration_email_registration_name($edit, $account) {
+  return $edit['name'];
+}
+
+/**
+ * Implementation of hook_migrate_prepare_user().
+ */
+function email_registration_migrate_prepare_user(&$newuser, $tblinfo, $row) {
+  // Generate a random username if none was provided
+  if (!$newuser['name']) {
+    // There is a tiny risk that the generated name will not be unique
+    $newuser['name'] = user_password();
+  }
+}
Index: email_registration.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/email_registration/email_registration.module,v
retrieving revision 1.5.2.11
diff -u -p -r1.5.2.11 email_registration.module
--- email_registration.module	14 Jul 2009 00:45:00 -0000	1.5.2.11
+++ email_registration.module	7 Jan 2010 22:37:24 -0000
@@ -45,7 +45,7 @@ function email_registration_user($op, &$
 
       // if email verification is off and a new user is the one creating account, log the new user in with correct name
       global $user;
-      if (!variable_get('user_email_verification', 1) && $user->uid == 0) {  
+      if (!variable_get('user_email_verification', 1) && $user->uid == 0) {
         $user = $account;
         $user->name = $namenew;
       }
@@ -104,4 +104,13 @@ function email_registration_user_login_v
       $form_state['values']['name'] = $name;
     }
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Implementation of hook_migrate_init().
+ */
+function email_registration_migrate_init() {
+  // Don't load migration support unless we need it
+  $path = drupal_get_path('module', 'email_registration') . '/email_registration.migrate.inc';
+  include_once($path);
+}
