Index: uc_signup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_signup/uc_signup.module,v
retrieving revision 1.35
diff -u -p -r1.35 uc_signup.module
--- uc_signup.module	7 Sep 2009 14:12:35 -0000	1.35
+++ uc_signup.module	7 Sep 2009 15:35:09 -0000
@@ -595,7 +595,7 @@ function uc_signup_order($op, &$arg1, $a
           foreach ($attendees as $key => $mail) {
             $account = user_load(array('mail' => $mail));
             if (empty($account->uid)) {
-              $new_account['mail'] = $mail;
+              $form_state['values']['mail'] = $mail;
               $namenew = preg_replace('/@.*$/', '', $mail);
               // From the email registration module:
               if (db_result(db_query("SELECT count(*) FROM {users} WHERE LOWER(name) = LOWER('%s')", $namenew)) > 0) {
@@ -604,15 +604,23 @@ function uc_signup_order($op, &$arg1, $a
                 $nameidx = db_result(db_query($sql, '^'. $namenew .'_[0-9]+$'));
                 $namenew .= '_'. ($nameidx + 1);
               }
-              $new_account['name'] = $namenew;
+              $form_state['values']['name'] = $namenew;
+              $form_state['values']['op'] = t('Create new account');
+              $form_state['values']['pass'] =  user_password(8);
+              $form_state['values']['notify'] = FALSE;
               $profile_form = array_values(module_invoke('profile', 'user', 'register', array(), (object)array()));
               $profile_form = $profile_form[0];
               foreach ($profile_form as $key => $value) {
                 if ($key[0] != '#') {
-                  $new_account[$key] = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
+                  $form_state['values'][$key] = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
                 }
               }
-              $account = user_save(NULL, $new_account);
+              drupal_execute('user_register', $form_state);
+              $account = $form_state['user'];
+              if (!$account->uid) {
+                uc_signup_cancel_temporary_signups($order);
+                return array(array('pass' => FALSE, 'message' => t('There was an error saving attendee contact information. Please verify that you have entered all required fields at the '. l('Attendee profile contact information form','uc_signup/attendees/profiles'))));
+              }
             }
             $to_signup[$nid][] = $account->uid;
           }
