diff --git a/README.txt b/README.txt
old mode 100644
new mode 100755
diff --git a/uc_signup.info b/uc_signup.info
old mode 100644
new mode 100755
index 2b2d4bf..b24cbdb
--- a/uc_signup.info
+++ b/uc_signup.info
@@ -1,3 +1,4 @@
+; $Id$
 name = Signup integration for Ubercart
 description = "Allows users to purchase signup.module signups via Ubercart"
 core = 6.x
@@ -7,4 +8,3 @@ dependencies[] = uc_product
 dependencies[] = uc_payment
 dependencies[] = ca
 dependencies[] = date
-dependencies[] = profile
diff --git a/uc_signup.install b/uc_signup.install
old mode 100644
new mode 100755
index 47e9bf6..f1ded2e
--- a/uc_signup.install
+++ b/uc_signup.install
@@ -1,4 +1,5 @@
 <?php
+// $Id$
 /*
  * Implementation of hook_schema.
  */
@@ -52,6 +53,30 @@ function uc_signup_uninstall() {
 }
 
 /**
+ * Implementation of hook_requirements().
+ */
+function uc_signup_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'runtime') {
+    $requirements['uc_signup']['title'] = t('Signup Integration for Ubercart');
+
+    // Check to see if either uc_signup_profile or uc_signup_cp are enabled.
+    $profile = module_exists('uc_signup_profile');
+    $cp = module_exists('content_profile');
+    if (!$profile && !$cp) {
+      // Neither is enabled.
+      $requirements['uc_signup']['description'] = t('It is recommended that you enable either the core Profile module, or Content Profile for use with UC Signup.');
+      $requirements['uc_signup']['severity'] = REQUIREMENT_WARNING;
+    }
+    else {
+      $requirements['uc_signup']['description'] = t('You have core profile or Content Profile module enabled.');
+      $requirements['uc_signup']['severity'] = REQUIREMENT_OK;
+    }
+  }
+  return $requirements;
+}
+
+/**
  * Ensure that uc_signup hooks are executed before payment modules.
  */
 function uc_signup_update_6000() {
@@ -99,4 +124,19 @@ function uc_signup_update_6001() {
   }
 
   return $ret;
-}
\ No newline at end of file
+}
+
+/**
+ * Enable uc_signup_profile module (as, for existing installs, this is
+ * an assumed dependency).
+ */
+function uc_signup_update_6002() {
+  $ret = array();
+  module_rebuild_cache();
+  drupal_install_modules(array('uc_signup_profile'));
+  $ret[] = array(
+    'success' => TRUE,
+    'query' => t('Enabled the UC Signup Profile module, as this functionality has been split out from UC Signup.'),
+  );
+  return $ret;
+}
diff --git a/uc_signup.module b/uc_signup.module
old mode 100644
new mode 100755
index f44a4b5..f1114fb
--- a/uc_signup.module
+++ b/uc_signup.module
@@ -1,9 +1,10 @@
 <?php
+// $Id$
 /*
  * Implementation of hook_perm().
  */
 function uc_signup_perm() {
-  return array('administer UC_Signup', 'purchase signups for other users');
+  return array('administer UC_Signup');
 }
 
 /*
@@ -46,7 +47,7 @@ function uc_signup_attendees_form_access() {
 function uc_signup_theme() {
   return array(
     'uc_signup_user_events' => array(
-      'arguments' => array('events' => array(), 'nodes' => array()),
+      'arguments' => array('events' => array(), $nodes => array()),
     ),
     'uc_signup_event_text' => array(
       'arguments' => array('node' => (object)array(), ),
@@ -57,135 +58,24 @@ function uc_signup_theme() {
     'uc_signup_needs_account' => array(
       'arguments' => array('message' => '', ),
     ),
-    'uc_signup_restrict_qty_field' => array(
-      'arguments' => array('form' => NULL),
-    ),
-    'uc_signup_confirmed_signups_text' => array(
-      'arguments' => array('signups' => NULL),
-    ),
   );
 }
 
 /*
- * Implementation of hook_requirements().
+ * Get the profile fields required on user registration.
  */
-
-function uc_signup_requirements($phase) {
-  if ($phase == 'runtime') {
-    $requirements['uc_signup']['title'] = t('Signup Integration for Ubercart');
-    $profile_form = uc_signup_profile_form();
-    if (empty($profile_form)) {
-      $requirements['uc_signup']['description'] = t('You have no core user
-        profile fields that are configured to show on the user registration form.
-        UC_Signup requires that you make at !action',
-        array('!action' => l(t('set at least one profile field to appear on the registration form.'), 'admin/user/profile')));
-      $requirements['uc_signup']['severity'] = REQUIREMENT_WARNING;
-    }
-    else {
-      $requirements['uc_signup']['description'] = t('You have at least one core profile field set to show up on the user registration form.');
-      $requirements['uc_signup']['severity'] = REQUIREMENT_OK;
-    }
+function uc_signup_profile_form() {
+  // TODO Generalize this...perhaps a hook?
+  if (module_exists('uc_signup_profile')) {
+    return uc_signup_profile_profile_form();
   }
-  return $requirements;
-}
-
-/**
- * Get the profile fields required for the uc_signup attendee information form.
- * 
- * @param $account
- *   (optional) The account object for which we need the user profile form.
- * @param $category_map
- *   (optional) Return a tree structure of form categories and fields, rather 
- *   than a complete form.
- */
-function uc_signup_profile_form($account = array(), $category_map = FALSE) {
-  $form = array();
-  // Get all user profile fields, then unset the ones we don't want to display.
-  // Since we're going to call profile_form_profile() with $register
-  // set to FALSE, we need to explicitly request each profile field category.
-  $query = db_query("SELECT name, category FROM {profile_fields}");
-  while ($result = db_fetch_object($query)) {
-    $categories[] = $result->category;
-    $fields[$result->name] = $result->category;
-  }
-  // Add each category of fields to the form.
-  include_once(drupal_get_path('module', 'user') .'/user.pages.inc');
-  foreach ($categories as $category) {
-    $form += profile_form_profile($account, (object)$account, $category, FALSE);
+  elseif (module_exists('uc_signup_cp')) {
+    return uc_signup_cp_profile_form();
   }
-  // Then, remove the fields that aren't configured to display in the uc_signup
-  // attendee information form.
-  foreach ($fields as $key => $category) {
-    if (!empty($form[$category][$key]) && !uc_signup_profile_field_visibility($key)) {
-      unset($form[$category][$key]);
-    }
-  }
-  // Unset any empty category fieldsets.
-  foreach (element_children($form) as $category) {
-    $children = element_children($form[$category]);
-    if (empty($children)) {
-      unset($form[$category]);
-    }
-  }
-  if ($category_map) {
-    return $form;
-  }
-  // We add these fields as values so that they're processed later
-  // via drupal_execute(). 
-  foreach (array('name', 'mail', 'op', 'notify', 'pass', 'status') as $key) {
-    $form[$key]['#type'] = 'value';
-  }
-  $form['#submit'][] = 'user_register_submit';
-  $form['#submit'][] = 'uc_signup_save_profile';
-  $form['#validate'][] = 'user_register_validate';
-  return $form;
 }
 
-/**
- * Save profile information for a newly created user. This is necessary because
- * the core Profile module will only save the fields that show on the user
- * registration form when creating a user, regardless of which fields
- * are specified. uc_signup saves this information after the user is created
- * because its weight is -1, and doing so before the core profile module
- * would cause the non-registration fields to be deleted by
- * profile_save_profile() when it saves the fields that do show on the user
- * registration form.
- */
-function uc_signup_save_profile($form, &$form_state) {
-  static $non_register_fields;
-  if (!isset($non_register_fields)) {
-    $non_register_fields = array();
-    $query = db_query("SELECT name, register FROM {profile_fields} WHERE register = 0");
-    while ($result = db_fetch_object($query)) {
-      $non_register_fields[$result->name] = $result->name;
-    }  
-  }
-  $non_register_values = array_intersect_key($form_state['values'], $non_register_fields);
-  // If there are no non_register values, then we don't need to save any data separately.
-  if (!empty($non_register_values)) {
-    $account = $form_state['user'];
-    $data = unserialize($account->data);
-    $category_map = uc_signup_profile_form(NULL, TRUE);
-    foreach ($category_map as $category => $category_fields) {
-      $values[$category] = array_intersect_key($form_state['values'], $category_fields);
-      // Don't save a category with no submitted values in that category.
-      if (!empty($values[$category])) {
-        // We need to re-submit the registration-only fields as well.
-        foreach ($values[$category] as $key => $value) {
-          // Unset these values from $account->data.
-          unset($data['$key']);
-        }
-        $account->data = serialize($data);
-        // We do one user_save() per profile category.
-        $account = user_save($account, $values[$category], $category);
-      }
-    }
-    $form_state['values']['user'] = $account;
-  }
-}
 function uc_signup_attendees_form_validate($form, &$form_state) {
   if ($form_state['storage']['step'] == 'emails') {
-    global $user;
     foreach ($form_state['values'] as $key => $value) {
       if (is_numeric($key)) {
         foreach ($form_state['values'][$key] as $num => $mail) {
@@ -202,32 +92,12 @@ function uc_signup_attendees_form_validate($form, &$form_state) {
           if (uc_signup_user_is_signed_up($mail, $key)) {
             form_set_error("$key][$num", t('The attendee with email address @mail is already signed up for this event', array('@mail' => $mail)));
           }
-          $message = uc_signup_invalid_mail($mail);
-          if (!empty($message)) {
-            form_set_error("$key][$num", $message);
-          }
         }
       }
     }
   }
 }
 
-function uc_signup_invalid_mail($mail) {
-  global $user;
-  if (!user_access('purchase signups for other users')) {
-    // Prevent authenticated users from loggin in other users.
-    if (user_is_logged_in() && $mail != $user->mail) {
-      return t('You are not authorized to register on behalf of other users.');
-    }
-    // Prevent anonymous users from registering for existing users.
-    if (user_is_anonymous()) {
-      $existing_account = user_load(array('mail' => $mail));
-      if (!empty($existing_account->uid)) {
-        return t('This email address corresponds to an existing account. If you wish to register using this account, please <a href="@login">log in.</a>', array('@login' => url('user', array('query' => drupal_get_destination()))));
-      }
-    }
-  }
-}
 function uc_signup_attendees_form_emails(&$form_state, $events) {
   $form_state['storage']['step'] = 'emails';
   global $user;
@@ -244,6 +114,11 @@ function uc_signup_attendees_form_emails(&$form_state, $events) {
       $date_formatted = ' - ' . strip_tags(content_format($date_field, $this_date_field[0]));
     }
 
+    $num = 0;
+    $form['instructions'] = array(
+      '#type' => 'markup',
+      '#value' => t("Please enter the email address of each attendee for this event. If an attendee does not have an account on this site, you'll be prompted to enter some information about that attendee."),
+    );
     $form[$event['nid']] = array(
       '#type' => 'fieldset',
       '#title' => check_plain($node->title) . $date_formatted,
@@ -252,71 +127,27 @@ function uc_signup_attendees_form_emails(&$form_state, $events) {
       '#tree' => TRUE,
     );
 
-    $num = 0;
-    $allow_multiple = user_access('purchase signups for other users');
-    // If user has permission to sign others up, allow them to sign
-    // up as many as the quantity is set to.
-    if ($allow_multiple) {
-      $form['instructions'] = array(
-        '#type' => 'markup',
-        '#value' => t("Please enter the email address of each attendee for this event. If an attendee does not have an account on this site, you'll be prompted to enter some information about that attendee."),
-      );
-      $max = $event['qty'];
-    }
-    // Otherwise, only show one email field.
-    else {
-      $max = 1;
-    }
-
-    while ($num < $max) {
-      // Provide a default value for the email address where appropriate.
+    while ($num < $event['qty']) {
       $default = $form_state['values'][$event['nid']][$num];
       if (empty($default)) {
         $default = $_SESSION['uc_signup']['nids'][$event['nid']][$num];
       }
-      // Prevent the system from setting a value that will fail validation
-      // when the user can't correct it. This can happen if the user enters
-      // an email address while anonymous, logs in with an account that
-      // does not have this email address, and returns to the
-      // uc_signup attendee emails form.
-      if ((empty($default) || uc_signup_invalid_mail($default)) && $num == 0) {
+      if (empty($default) && $num == 0) {
+        global $user;
         $account = $user;
-        if (user_is_logged_in() && !uc_signup_user_is_signed_up($account->mail, $event['nid'])) {
+        if (!empty($account->uid) && !uc_signup_user_is_signed_up($account->mail, $event['nid'])) {
           $default = $account->mail;
         }
       }
-      // Catch-all to avoid setting to a value that would fail validation.
-      if (!empty($validation_message)) {
-        $default = $account->mail;
-      }
-      // If default is empty, this is an anonymous user, so they
-      // must be allowed to enter an e-mail address.
-      if ($allow_multiple || empty($default) || user_is_anonymous()) {
-        $form[$event['nid']][$num] = array(
-          '#type' => 'textfield',
-          '#title' => t('Email Address of Attendee #%count', array('%count' => $num + 1)),
-          '#default_value' => $default,
-          '#required' => TRUE,
-        );
-      }
-      else {
-        // Display read-only e-mail address.
-        $_SESSION['uc_signup']['nids'][$event['nid']][0] = $user->mail;
-        $default = $user->mail;
-        $form[$event['nid']][$num] = array(
-          '#type' => 'value',
-          '#value' => $default,
-        );
-        $form[$event['nid']]['display'] = array(
-          '#type' => 'markup',
-          '#title' => '',
-          '#value' => t('E-mail address of attendee: @mail', array('@mail' => $default)),
-        );
-      }
+      $form[$event['nid']][$num] = array(
+        '#type' => 'textfield',
+        '#title' => t('Email Address of Attendee #%count', array('%count' => $num + 1)),
+        '#default_value' => $default,
+        '#required' => TRUE,
+      );
       $num ++;
     }
   }
-
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Next step'),
@@ -392,7 +223,6 @@ function uc_signup_attendees_form(&$form_state = NULL, $menu_path = NULL) {
 }
 
 function uc_signup_attendees_form_profiles(&$form_state, $events = array()) {
-  global $user;
   $form_state['storage']['step'] = 'profiles';
   $mails = array();
   $nodes = array();
@@ -403,10 +233,6 @@ function uc_signup_attendees_form_profiles(&$form_state, $events = array()) {
       $nodes[$nid] = node_load($nid);
     }
     foreach ($attendees as $key => $mail) {
-      if (user_is_logged_in() && !user_access('purchase signups for other users')) {
-        $mail = $user->mail;
-        $_SESSION['uc_signup']['nids'][$nid][0] = $mail;
-      }
       if (is_numeric($nid)) {
         $mails[$mail][] = $nid;
       }
@@ -429,36 +255,28 @@ function uc_signup_attendees_form_profiles(&$form_state, $events = array()) {
 
     // Is there an account for this email address?
     $account = user_load(array('mail' => $mail));
-    // Either there is no account, or the site is configured to have
-    // authenticated users fill out profile fields and the current user
-    // is signing herself up.
-    if (empty($account->uid) || (variable_get('uc_signup_auth_fields', 0) && $account->uid == $user->uid)) {
-      $profile_form = uc_signup_profile_form((array)$account);
+    if (empty($account->uid)) {
+      $profile_form = uc_signup_profile_form();
       if (!empty($profile_form)) {
         $form[$mail]['profile'] = $profile_form;
-        foreach ($form[$mail]['profile'] as $group => $fields) {
-          foreach ($fields as $key => $value) {
-            $default = $form_state['values']['profile'][$key .'_'. $mail];
-            if (empty($default)) {
-              $default = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
-            }
-            if (empty($default)) {
-              $default = $profile_form[$group][$key]['#default_value'];
-            }
-            if ($key[0] != '#') {
-              $form[$mail]['profile'][$group][$key .'_'. $mail] = $value;
-              unset($form[$mail]['profile'][$group][$key]);
-              $form[$mail]['profile'][$group][$key .'_'. $mail]['#default_value'] = $default;
-              $form[$mail]['profile'][$group][$key .'_'. $mail]['#parents'] = array('profile', $key .'_'. $mail);
-            }
+        foreach ($form[$mail]['profile'] as $key => $value) {
+          $default = $form_state['values']['profile'][$key .'_'. $mail];
+          if (empty($default)) {
+            $default = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
+          }
+          if ($key[0] != '#') {
+            $form[$mail]['profile'][$key .'_'. $mail] = $value;
+            unset($form[$mail]['profile'][$key]);
+            $form[$mail]['profile'][$key .'_'. $mail]['#default_value'] = $default;
+            $form[$mail]['profile']['#tree'] = TRUE;
           }
+          drupal_add_css(drupal_get_path('module', 'uc_signup') .'/uc_signup.css');
+          $form[$mail]['has_account'] = array(
+            '#type' => 'markup',
+            '#value' => theme('uc_signup_needs_account', t('Please enter additional information about this attendee.')),
+            '#weight' => -4,
+          );
         }
-        drupal_add_css(drupal_get_path('module', 'uc_signup') .'/uc_signup.css');
-        $form[$mail]['has_account'] = array(
-          '#type' => 'markup',
-          '#value' => theme('uc_signup_needs_account', t('Please enter additional information about this attendee.')),
-          '#weight' => -4,
-        );
       }
     }
     else {
@@ -510,39 +328,11 @@ function theme_uc_signup_event_text($node = NULL) {
     $date_field_name = $date_field['field_name'];
     $this_date_field = $node->$date_field_name;
     $date_formatted = ' - ' . content_format($date_field, $this_date_field[0]);
-
   }
-  return check_plain($node->title) . $date_formatted;
-}
 
-function theme_uc_signup_restrict_qty_field($element = array()) {
-  return check_plain($element['#value']);
+  return check_plain($node->title) . $date_formatted;
 }
 
-function theme_uc_signup_confirmed_signups_text($signups = NULL, $admin = FALSE) {
-  static $nodes;
-  $output = '';
-  if (!empty($signups)) {
-    if ($admin) {
-      $output .= t('The following signup ids where created:') . '<br />';
-    }
-    else {
-      $output .= t("Below are signup confirmation numbers for this order.<br /> Please note that these confirmation numbers are specific to each attendee. <br />");  
-    }
-        
-    foreach ($signups as $mail => $user_signups) {
-      $output .= '<p>'. t('@mail is attending:<br />', array('@mail' => $mail));
-      foreach ($user_signups as $signup) {
-        if (empty($nodes[$signup->nid])) {
-          $nodes[$signup->nid] = node_load($signup->nid);
-        }
-        $output .= theme('uc_signup_event_text', $nodes[$signup->nid]) . ' : ' . t('Confirmation #@sid', array('@sid' => $signup->sid)) . " <br />";  
-      }
-      $output .= '</p>';
-    }
-  }
-  return $output;
-}
 /*
  * Implementation of hook_signup_suppress.
  * Prevent the Signup from appearing on non-free signup-enabled nodes.
@@ -566,67 +356,10 @@ function uc_signup_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   }
 }
 
-
-function uc_signup_profile_field_visibility($fid) {
-  if (!is_numeric($fid)) {
-    $fid = db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'", $fid));
-  }
-  // First, check whether we've set this value already.
-  $uc_signup_field_visibility = variable_get('uc_signup_field_visibility', array());
-  if (isset($uc_signup_field_visibility[$fid])) {
-    return $uc_signup_field_visibility[$fid];
-  }
-  // If not, default to the current user profile field visibility setting.
-  static $fields;
-  if (empty($fields[$fid])) {
-    $query = db_query("SELECT name, visibility, register FROM {profile_fields}");
-    while ($result = db_fetch_array($query)) {
-      $fields[$result['name']] = $result;
-    }
-  }
-  // Is this an admin-only field?
-  if ($fields[$fid]['visibility'] == 4) {
-    return 0;
-  }
-  // Default to the "Visible in user registration form" setting.
-  return $fields[$fid]['register'];
-}
-
-function uc_signup_profile_field_form_submit($form, &$form_state) {
-  uc_signup_set_profile_field_visibility($form_state['values']);
-}
-
-function uc_signup_set_profile_field_visibility($values) {
-  // The form is being submitted as the field is being created, so we
-  // don't have the fid in the $form_state['values'] yet.
-  if (empty($values['fid'])) {
-    $values['fid'] = db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'", $values['name']));
-  }
-  if (isset($values['uc_signup_visibility'])) {
-    $uc_signup_field_visibility = variable_get('uc_signup_field_visibility', array());
-    $uc_signup_field_visibility[$values['fid']] = $values['uc_signup_visibility'];
-    variable_set('uc_signup_field_visibility', $uc_signup_field_visibility);
-  }
-}
 /*
  * Implementation of hook_form_alter().
  */
 function uc_signup_form_alter(&$form, &$form_state, $form_id) {
-  // Add the "Visible in uc_signup attendee information form" checkbox
-  // to core profile field settings.
-  if ($form_id == 'profile_field_form') {
-    $form['fields']['uc_signup_visibility'] = array(
-      '#type' => 'checkbox',
-      '#default_value' => uc_signup_profile_field_visibility($form['fields']['name']['#default_value']),
-      '#title' => t('Visible in uc_signup attendee information form.'),
-    );
-    $form['#submit'][] = 'uc_signup_profile_field_form_submit';
-  }
-  // Delete entries in the uc_signup_field_visibility variable when profile
-  // fields are deleted.
-  if ($form_id == 'profile_field_delete') {
-    $form['#submit'][] = 'uc_signup_profile_field_delete_submit';
-  }
   if ($form_id == 'uc_cart_checkout_form') {
     global $user;
     if (!$user->uid && !empty($_SESSION['uc_signup']['nids'])) {
@@ -650,13 +383,7 @@ function uc_signup_form_alter(&$form, &$form_state, $form_id) {
           if (isset($form['qty'])) {
             $form['qty']['#disabled'] = TRUE;
           }
-        }
-        // Signup.module hasn't imposed any restrictions on signing up.
-        // Limit the product quantity to 1, if the user can't sign up others.
-        elseif(!user_access('purchase signups for other users')) {
-          $form['qty']['#value'] = 1;
-          $form['qty']['#access'] = FALSE;
-        }
+        } 
       }
 
       //The quantity field is not always enabled on this form.
@@ -666,62 +393,19 @@ function uc_signup_form_alter(&$form, &$form_state, $form_id) {
     }
   }
   if ($form_id == 'uc_cart_view_form') {
-    // Restrict quantity if the user can't sign up other users.
-    if (!user_access('purchase signups for other users')) {
-      $item_keys = element_children($form['items']);
-      if (!empty($item_keys)) {
-        foreach ($item_keys as $key) {
-          $data = unserialize($form['items'][$key]['data']['#value']);
-          if ($data['uc_signup_enabled']) {
-            $form['items'][$key]['qty']['#type'] = 'value';
-            $form['items'][$key]['qty']['#value'] = '1';
-            $form['items'][$key]['qty']['#theme'] = 'uc_signup_restrict_qty_field';
-          }
-        }
-      }
-    }
     $form['#validate'][] = 'uc_signup_cart_view_form_validate';
     $form['checkout']['#submit'][] = 'uc_signup_cart_view_form_submit';
     $form['update']['#submit'][] = 'uc_signup_cart_view_form_submit';
   }
 }
 
-
-/**
- * Delete entries in the uc_signup_field_visibility variable when profile
- * fields are deleted.
- */
-function uc_signup_profile_field_delete_submit($form, &$form_state) {
-  if (!empty($form_state['values']['fid'])) {
-    $uc_signup_field_visibility = variable_get('uc_signup_field_visibility', array());
-    unset($uc_signup_field_visibility[$form_state['values']['fid']]);
-    variable_set('uc_signup_field_visibility', $uc_signup_field_visibility);
-  }
-}
-/**
- * Implementation of hook_add_to_cart().
- */
-function uc_signup_add_to_cart($nid, $qty, $data) {
-  // Enforce the 'purchase signups for other users' permission by only allowing
-  // one of a paritcular signup-enabled node in the cart at a time.
-  if ($data['uc_signup_enabled']) {
-    if (!user_access('purchase signups for other users')) {
-      foreach (uc_cart_get_contents() as $item) {
-        if ($item->nid == $nid) {
-          uc_cart_remove_item($nid, $item->cart_id, $item->data);
-        }
-      }
-    }
-  }
-}
-
 function uc_signup_cart_view_form_submit($form, &$form_state) {
   if (!empty($form_state['values']['items'])) {
     foreach ($form_state['values']['items'] as $item) {
       if ($item['remove']) {
         unset($_SESSION['uc_signup']['nids'][$item['nid']]);
       }
-      if ($item['qty'] < count($_SESSION['uc_signup']['nids'][$item['nid']])) {
+      if ($item['qty'] <  count($_SESSION['uc_signup']['nids'][$item['nid']])) {
         array_splice($_SESSION['uc_signup']['nids'][$item['nid']], $item['qty']);
       }
     }
@@ -870,7 +554,6 @@ function uc_signup_checkout_pane() {
  * Callback for uc_signup_checkout_pane.
  */
 function uc_signup_attendees_pane($op, $arg1, $arg2) {
-  
   switch ($op) {
     case 'view':
       $contents = uc_cart_get_contents();
@@ -878,32 +561,9 @@ function uc_signup_attendees_pane($op, $arg1, $arg2) {
         if (isset($product->data['uc_signup_enabled']) && $product->data['uc_signup_enabled'] == 1) {
           $signups = TRUE;
         }
-        if ($signups && $product->data['uc_signup_enabled']) {
+        if ($signups && $product->data['uc_signup_enabled'] && (empty($_SESSION['uc_signup']['nids'][$product->nid]) || count($_SESSION['uc_signup']['nids'][$product->nid]) < $product->qty)) {
           // TODO: make it impossible to rediret infinitely.
-          if (empty($_SESSION['uc_signup']['nids'][$product->nid]) || count($_SESSION['uc_signup']['nids'][$product->nid]) < $product->qty) {
-            // Skip the attendee email page if this is an authenticted user who
-            // cannot purchase signups for other users.
-            if (user_is_logged_in() && !user_access('purchase signups for other users')) {
-              global $user;
-              // There can only be one value here.
-              $_SESSION['uc_signup']['nids'][$product->nid][0] = $user->mail;  
-            }
-            else {
-              drupal_goto('uc_signup/attendees/emails');
-            }
-          }
-          else {
-            // Check to see if a profile has been submitted for each new
-            // attendee. If not, the profile page hasn't been completed yet.
-            foreach ($_SESSION['uc_signup']['nids'][$product->nid] as $attendee) {
-              $account = user_load(array('mail' => $attendee));
-              if (!$account->uid) {
-                if (empty($_SESSION['uc_signup']['profile']) || strpos(implode(' ', array_keys($_SESSION['uc_signup']['profile'])), $attendee) === FALSE) {
-                  drupal_goto('uc_signup/attendees/profiles');
-                }
-              }
-            }
-          }
+          drupal_goto('uc_signup/attendees/emails');
         }
       }
       $mails = array();
@@ -925,10 +585,7 @@ function uc_signup_attendees_pane($op, $arg1, $arg2) {
           $output .= theme('uc_signup_user_events', $events, $nodes);
           $output .= "</div>";
         }
-        if (user_is_anonymous() || (user_access('purchase signups for other users') || variable_get('uc_signup_auth_fields', 0))) {
-          $output .= l(t('Edit signup information'), 'uc_signup/attendees/emails', array('attributes' => array('class' => 'uc_signup_edit_info')));
-        }
-        
+        $output .= l(t('Edit signup information'), 'uc_signup/attendees/emails', array('attributes' => array('class' => 'uc_signup_edit_info')));
         $pane['uc_signup'] = array(
           '#value' => $output,
           '#weight' => variable_get('uc_pane_cart_field_cart_weight', 2),
@@ -945,7 +602,7 @@ function uc_signup_attendees_pane($op, $arg1, $arg2) {
 function uc_signup_order_pane() {
   $panes[] = array(
     'id' => 'uc_signup_info',
-    'callback' => 'uc_signup_order_info_pane',
+    'callback' => 'uc_signup_info_pane',
     'title' => t('Event Signup Information'),
     'desc' => t(""),
     'class' => 'pos-left',
@@ -955,16 +612,6 @@ function uc_signup_order_pane() {
   return $panes;
 }
 
-function uc_signup_order_info_pane($op, $arg1) {
-  if ($op == 'customer' || $op == 'view') {
-    $order = $arg1;
-    $signups = uc_signup_confirmed_signups($order->order_id);
-    if (!empty($signups)) {
-      $output = theme('uc_signup_confirmed_signups_text', $signups);
-      return $output;
-    }
-  }
-}
 /**
  * Implementation of hook_order().
  */
@@ -989,21 +636,22 @@ function uc_signup_order($op, &$arg1, $arg2) {
               $form_state['values']['mail'] = $mail;
               $form_state['values']['name'] = uc_store_email_to_username($mail);
               $form_state['values']['op'] = t('Create new account');
-              $form_state['values']['pass'] = $random_password;
+              $form_state['values']['pass']['pass1'] = $random_password;
+              $form_state['values']['pass']['pass2'] = $random_password;
               $form_state['values']['notify'] = (bool)variable_get('uc_signup_account_notify', 1);
-              $form_state['values']['status'] = 1;
-              $profile_form =  uc_signup_profile_form();
-              uc_signup_normalize_values($form_state, $mail, $profile_form);
+
+              foreach (module_implements('uc_signup_profile_values') as $module) {
+                $function = $module . '_uc_signup_profile_values';
+                $function($form_state, $mail);
+              }
+
               //We masquerade as user 1 in case there is captcha or other protection on the user_register form that could cause submission to fail.
               global $user;
               $temp_user = $user;
               //Always set this to false in case the operation fails.
               session_save_session(FALSE);
               $user = user_load(1);
-              // We use drupal_execute to enforce form validation on required
-              // fields. See http://drupal.org/node/547242 for an example of
-              // why this is necessary.
-              drupal_execute('uc_signup_profile_form', $form_state);
+              drupal_execute('user_register', $form_state);
               $user = $temp_user;
               session_save_session(TRUE);
               $account = $form_state['user'];
@@ -1012,18 +660,6 @@ function uc_signup_order($op, &$arg1, $arg2) {
                 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'))));
               }
             }
-            // An existing user is saving account information with the 
-            // 'uc_signup_auth_fields' setting enabled.
-            elseif (variable_get('uc_signup_auth_fields', 0)) {
-              $form_state = array();
-              $profile_form = uc_signup_profile_form((array)$account);
-              uc_signup_normalize_values($form_state, $mail, $profile_form);
-              if (!empty($form_state)) {
-                user_save((object)$account, $form_state['values']);
-                // TODO: Add some visible confirmation to the user that
-                // that the information was saved?
-              }
-            }
             $to_signup[$nid][] = $account->uid;
           }
         }
@@ -1046,18 +682,6 @@ function uc_signup_order($op, &$arg1, $arg2) {
 }
 
 
- /**
- * Assemble form_state values with normal profile field keys from the data that
- * is stored in the session with email address prefixed keys.
- */
-function uc_signup_normalize_values(&$form_state, $mail, $profile_form) {
-  foreach ($profile_form as $group => $fields) {
-    foreach ($fields as $key => $value) {
-      $form_state['values'][$key] = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
-    }
-  }
-}
-
 /*
  * Create a placeholder signup for a user.
  */
@@ -1099,20 +723,12 @@ function uc_signup_mark_paid($order, $settings = array()) {
       }
       //Signup.module checks for $node->signup_forwarding_email for us.
       signup_send_forwarding_mail($signup, $nodes[$signup->nid]);
-
-      // Invoke this hook again, as it was first
-      // invoked with the anonymous user. 
-      module_invoke_all('signup_sign_up', $nodes[$signup->nid], $accounts[$signup->uid]);
       
       unset($account);
       unset($signup);
     }
   }
-  // Archive the finalized sids in the order in case they are deleted from the
-  // database.
-  $signups = uc_signup_confirmed_signups($order->order_id);
-  $message = theme('uc_signup_confirmed_signups_text', $signups, TRUE);
-  uc_order_comment_save($order->order_id, 0, $message); 
+
   unset($_SESSION['uc_signup']);
 }
 
@@ -1162,12 +778,6 @@ function uc_signup_settings_form() {
     '#description' => t("When enabled account activation emails will be sent when uc_signup automatically creates accounts."),
     '#default_value' => variable_get('uc_signup_account_notify', 1),
   );
-  $form['uc_signup_auth_fields'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Display user profile fields to authenticated users.'),
-    //  TODO: Description
-    '#default_value' => variable_get('uc_signup_auth_fields', 0),
-  );
   return system_settings_form($form);
 }
 
@@ -1191,38 +801,6 @@ function uc_signup_cancel_temporary_signups($order, $settings = array()) {
   }
 }
 
-/**
- * Implementation of hook_token_list().
- */
-function uc_signup_token_list($type = 'all') {
-  $tokens = array();
-  if ($type == 'order' || $type == 'ubercart' || $type == 'all') {
-    $tokens['order']['order-signups'] = t('Finalized signups associated with the order.');
-  }
-  return $tokens;
-}
-
-/**
- * Implementation of hook_token_values().
- */
-function uc_signup_token_values($type, $object = NULL) {
-  $values = array();
-  if ($type == 'order' || $type == 'ubercart' || $type == 'all') {
-    $order = $object;
-    $signups = uc_signup_confirmed_signups($order->order_id);
-    $values['order-signups'] = theme('uc_signup_confirmed_signups_text', $signups);
-  }
-  return $values;
-}
-
-function uc_signup_confirmed_signups($oid = 0) {
-  // TODO: Consider adding nid to the uc_signup_log table to reduce joins.
-  $query = db_query("SELECT ucl.oid, ucl.sid, ucl.uid, u.mail, sl.nid FROM uc_signup_log ucl INNER JOIN {users} u on ucl.uid = u.uid INNER JOIN {signup_log} sl ON sl.sid = ucl.sid WHERE oid = %d AND type = 1", $oid);
-  while ($result = db_fetch_object($query)) {
-    $signups[$result->mail][$result->nid] = $result;
-  }
-  return $signups;
-}
 function _uc_signup_get_temporary_signups($order) {
   $query = db_query("SELECT sl.*, ucl.uid FROM {signup_log} sl INNER JOIN {uc_signup_log} ucl ON ucl.sid = sl.sid WHERE ucl.oid = %d AND ucl.type = 0", $order->order_id);
   while ($result = db_fetch_object($query)) {
diff --git a/uc_signup_cp.info b/uc_signup_cp.info
new file mode 100644
index 0000000..96c76c3
--- /dev/null
+++ b/uc_signup_cp.info
@@ -0,0 +1,7 @@
+; $Id$
+name=UC Signup Content Profile
+description=Integrates Content Profile module with UC Signup
+core=6.x
+dependencies[] = uc_signup
+dependencies[] = content_profile_registration
+package=Signup
\ No newline at end of file
diff --git a/uc_signup_cp.module b/uc_signup_cp.module
new file mode 100644
index 0000000..d84dadd
--- /dev/null
+++ b/uc_signup_cp.module
@@ -0,0 +1,66 @@
+<?php
+// $Id$
+/**
+ * @file
+ * Integrates Content Profile with UC Signup.
+ */
+
+/**
+ * Return the registration form fields defined by content profile.
+ */
+function uc_signup_cp_profile_form() {
+  require_once drupal_get_path('module', 'node') .'/node.pages.inc';
+  $default_types = content_profile_get_types('names', 'registration_use');
+  $form = array();
+  foreach ($default_types as $type => $typename) {
+    $form_state = array();
+    // Fake a node here so that content_profile doesn't redirect.
+    $form_state['node'] = array('nid' => FALSE);
+    content_profile_registration_add_profile_form($type, $form, $form_state);
+  }
+  if (empty($form['#field_info'])) {
+    return;
+  }
+
+  $new_form = array();
+  foreach ($form['#field_info'] as $field => $value) {
+    $new_form[$field] = $form[$field];
+  }
+
+  $extras = array(
+    '#field_info', '#pre_render', '#content_profile_weights', '#attributes',
+  );
+  foreach ($extras as $key) {
+    $new_form[$key] = $form[$key];
+  }
+
+  return $new_form;
+}
+
+/**
+ * Implementation of hook_form_alter().
+ */
+function uc_signup_cp_form_alter(&$form, $form_state, $form_id) {
+  if ($form_id == 'uc_signup_attendees_form') {
+    foreach (element_children($form) as $key => $value) {
+      if (isset($form[$value]['profile']['#attributes']['enctype'])) {
+        // For filefields.
+        $form['#attributes']['enctype'] = $form[$value]['profile']['#attributes']['enctype'];
+      }
+      if (isset($form[$value]['profile']['#field_info'])) {
+        // CCK modules such as Option Widgets expect #field_info to be in the top level of the form.
+        $form['#field_info'] = $form[$value]['profile']['#field_info'];
+      }
+    }
+  }
+}
+
+/**
+ * Implementation of hook_uc_signup_profile_values().
+ */
+function uc_signup_cp_uc_signup_profile_values(&$form_state, $mail) {
+  $form = uc_signup_cp_profile_form();
+  foreach ($form['#field_info'] as $name => $field) {
+    $form_state['values'][$name] = $_SESSION['uc_signup']['profile'][$name . '_' . $mail];
+  }
+}
\ No newline at end of file
diff --git a/uc_signup_profile.info b/uc_signup_profile.info
new file mode 100644
index 0000000..f700b45
--- /dev/null
+++ b/uc_signup_profile.info
@@ -0,0 +1,7 @@
+; $Id$
+name=UC Signup Profile
+description=Integrates core Profile module with UC Signup
+core=6.x
+dependencies[] = uc_signup
+dependencies[] = profile
+package=Signup
\ No newline at end of file
diff --git a/uc_signup_profile.install b/uc_signup_profile.install
new file mode 100644
index 0000000..5bf70ec
--- /dev/null
+++ b/uc_signup_profile.install
@@ -0,0 +1,26 @@
+<?php
+// $Id$
+
+/**
+ * Implementation of hook_requirements().
+ */
+function uc_signup_profile_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'runtime') {
+    $requirements['uc_signup_profile']['title'] = t('Signup and Profile Integration for Ubercart');
+    $profile_form = uc_signup_profile_form();
+    if (empty($profile_form)) {
+      $requirements['uc_signup_profile']['description'] = t('You have no core user
+        profile fields that are configured to show on the user registration form.
+        UC_Signup requires that you make at !action',
+        array('!action' => l(t('set at least one profile field to appear on the registration form.'), 'admin/user/profile')));
+      $requirements['uc_signup_profile']['severity'] = REQUIREMENT_WARNING;
+    }
+    else {
+      $requirements['uc_signup_profile']['description'] = t('You have at least one core profile field set to show up on the user registration form.');
+      $requirements['uc_signup_profile']['severity'] = REQUIREMENT_OK;
+    }
+  }
+  return $requirements;
+}
+
diff --git a/uc_signup_profile.module b/uc_signup_profile.module
new file mode 100644
index 0000000..56dba65
--- /dev/null
+++ b/uc_signup_profile.module
@@ -0,0 +1,34 @@
+<?php
+// $Id$
+/**
+ * @file
+ * Provides integration between the core Profile module and UC Signup.
+ */
+
+/**
+ * Return the profile form.
+ */
+function uc_signup_profile_profile_form() {
+  include_once(drupal_get_path('module', 'user') .'/user.pages.inc');
+  $form = profile_form_profile(array(), (object)array(), NULL, TRUE);
+  // $form now has a fieldset for each profile field category.
+  // We want an array of individual field elements from the first category.
+  $form = array_values($form);
+  $form = $form[0];
+  foreach (element_children($form) as $key => $val) {
+    $new_form[$val] = $form[$val];
+  }
+  return $new_form;
+}
+
+/**
+ * Implementation of hook_uc_signup_profile_values().
+ */
+function uc_signup_profile_uc_signup_profile_values(&$form_state, $mail) {
+  $profile_form =  uc_signup_profile_form($form_state);
+  foreach ($profile_form as $key => $value) {
+    $form_state['values'][$key] = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
+  }
+}
+              
+
diff --git a/views/README.txt b/views/README.txt
new file mode 100755
index 0000000..a3031aa
--- /dev/null
+++ b/views/README.txt
@@ -0,0 +1,44 @@
+// $Id:
+UC_Signup - README
+
+UC_Signup provides integration between Signup.module and Ubercart, allowing users to purchase signups for events.
+
+Approach:
+Signup-enabled nodes are configured as Ubercart products. When an order is submitted, if it contains any signup-enabled products, the user associated with the order is automatically signed up for each event in the cart. Once checkout is complete, if the order balance is not cleared, the signups are cancelled. If the balance is cleared, the signups are converted from temporary to final signups. UC_Signup stores this distinction in the form_data column of signup_log, where it also records the order id.
+
+UC_Signup uses the Ubercart Conditional Actions system to finalize and cancel signups for an order.
+
+This module was written by <a href="http://drupal.org/user/69959/">ezra-g</a> from <a href="http://growingventuresolutions.com/">Growing Venture Solutions</a>, working in association with <a href="http://dtek.net">D-Tek Digital Media</a>, and is being sponsored by <a href="http://www.aussiepd.com/">AUSSIE</a>.
+
+Setup:
+1) Create one or more Ubercart product classes at admin/store/products/classes
+2) Make the resulting content types signup-enabled at admin/content/types
+3) Add a date field to the resulting contents type at admin/content/types
+4) Fill out the "Date field to use with signup" inside the "Signup settings" fieldset when configuring
+   the content type at http://localhost/dev/gvs/aussie/admin/content/node-type/[type-name]
+
+Optional Configuration:
+- Configure the uc_signup_admin_list view for use as the Signup.module administrative view.
+  This View contains a link to the signup associated with an order and does not include the Signup.module's "extra information"
+  field which is generally supercedeed by user profile fields.
+  Browse to admin/settings/signup , open the "Advanced settings" fieldset
+  and for the "View to embed for the signup administrative list" option, select the page display of the
+  uc_signup_admin_list view.
+
+- Add user profile fields to display on this view.
+
+- Specify the text that should appear in the "Add to cart" button, such as "Sign up", as well as the text to use for this button when signups are disabled for a node.
+at http://localhost/dev/gvs/aussie/admin/store/products/signup
+
+- Prevent the signup tab from displaying to non-administrators
+  on signup-enabled nodes (http://localhost/dev/gvs/aussie/admin/settings/signup).
+
+Cancelling/Changing Signups:
+  Users can edit their profile fields (as long as they have permission),
+  but any changes to a signup, such as who is attending, which event is being attended
+  or cancellations must be made by an administrator. Refunds can be handled through Ubercart,
+  and Signup.module provides the following administrator permisisons:
+  "cancel signups" "administer all signups", "view all signups" .
+  The Signups tab will display to administrators on signup-enabled nodes
+  and provides acccess to these administrative features.
+   from the signup tab provided 
\ No newline at end of file
diff --git a/views/images/blue-question.png b/views/images/blue-question.png
new file mode 100755
index 0000000..7574742
Binary files /dev/null and b/views/images/blue-question.png differ
diff --git a/views/images/green-check.png b/views/images/green-check.png
new file mode 100755
index 0000000..cd2ce0b
Binary files /dev/null and b/views/images/green-check.png differ
diff --git a/views/uc_signup.css b/views/uc_signup.css
new file mode 100755
index 0000000..91f7c3f
--- /dev/null
+++ b/views/uc_signup.css
@@ -0,0 +1,15 @@
+.uc_signup_needs_account {
+  background-image: url(./images/blue-question.png);
+  background-repeat: no-repeat;
+  padding: 0px 0px 21px 20px;
+}
+
+.uc_signup_has_account {	
+  background-image: url(./images/green-check.png);
+  background-repeat: no-repeat;
+  padding: 0px 0px 21px 20px;
+}
+
+.uc_signup_next {
+  margin-left: 25px;
+}
\ No newline at end of file
diff --git a/views/uc_signup.info b/views/uc_signup.info
new file mode 100755
index 0000000..2cb9f16
--- /dev/null
+++ b/views/uc_signup.info
@@ -0,0 +1,11 @@
+; $Id$
+name = Signup integration for Ubercart
+description = "Allows users to purchase signup.module signups via Ubercart"
+core = 6.x
+package = Signup
+dependencies[] = signup
+dependencies[] = uc_product
+dependencies[] = uc_payment
+dependencies[] = ca
+dependencies[] = date
+dependencies[] = profile
diff --git a/views/uc_signup.install b/views/uc_signup.install
new file mode 100755
index 0000000..b81982e
--- /dev/null
+++ b/views/uc_signup.install
@@ -0,0 +1,103 @@
+<?php
+// $Id$
+/*
+ * Implementation of hook_schema.
+ */
+function uc_signup_schema() {
+  $schema['uc_signup_log'] = array(
+    'description' => t(''),
+    'fields' => array(
+      'oid' => array(
+        'description' => t("The Order ID where the signup was purchased."),
+        'type' => 'int',
+        'size' => 'normal',
+        'not null' => TRUE,
+      ),
+      'sid' => array(
+        'description' => t("The Signup ID."),
+        'type' => 'int',
+        'size' => 'normal',
+        'not null' => TRUE,
+      ),
+      'uid' => array(
+        'description' => t("The user associated with the signup."),
+        'type' => 'int',
+        'size' => 'normal',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'type' => array(
+        'description' => t("The Signup type. 0: pre-charge placeholder, 1: finalized signup."),
+        'type' => 'int',
+        'size' => 'normal',
+        'not null' => TRUE,
+      ),
+    ),
+  );
+  return $schema;
+}
+
+/**
+ * Implementation of hook_install
+ */
+function uc_signup_install() {
+  drupal_install_schema('uc_signup');
+  db_query("UPDATE {system} SET weight = -1 WHERE name = 'uc_signup'");
+}
+
+/**
+ * Implementation of hook_uninstall
+ */
+function uc_signup_uninstall() {
+  drupal_uninstall_schema('uc_signup');
+}
+
+/**
+ * Ensure that uc_signup hooks are executed before payment modules.
+ */
+function uc_signup_update_6000() {
+  $ret = array();
+  $ret[] = update_sql("UPDATE {system} SET weight = -1 WHERE name = 'uc_signup'");
+  return $ret;
+}
+
+/**
+ * Add the UID column to {uc_signup_log} and update placeholder signups to the
+ * new format per http://drupal.org/node/839640.
+ */
+function uc_signup_update_6001() {
+  $ret = array();
+  $attributes = array(
+    'type' => 'int',
+    'size' => 'normal',
+    'not null' => TRUE,
+    'default' => 0,
+  );
+  db_add_field($ret, 'uc_signup_log', 'uid', $attributes);
+  // Preserve the association between placeholder signups and users.
+  $ret[] = update_sql("UPDATE {uc_signup_log} ucl INNER JOIN {signup_log} sl on sl.sid = ucl.sid SET ucl.uid = sl.uid");
+  // Assign placeholder signups to anonymous users.
+  // First, load all placeholder signups.
+  $query = db_query("SELECT sl.* FROM {signup_log} sl INNER JOIN {uc_signup_log} ucl ON ucl.sid = sl.sid WHERE ucl.type = 0");
+  while ($result = db_fetch_object($query)) {
+    $temp_signups[] = $result;
+  }
+  // Then, switch the signup to an anonymous (placeholder) user and save the signup.
+  if (!empty($temp_signups)) {
+    foreach ($temp_signups as $temp_signup) {
+      // Don't re-process placeholder signups that are already assigned to uid 0.
+      if (!empty($temp_signup->uid)) {
+        $temp_signup->uid = 0;
+        $temp_signup->anon_mail = 'placeholder-' . rand(111111, 99999) . '@example.com';
+        $temp_signup = (array)$temp_signup;
+        signup_save_signup($temp_signup);
+        $count ++;
+      }
+    }
+    if (!empty($count)) {
+      $ret[] = array('success' => TRUE, 'query' => t('Updated %count placeholder @signups to the new format per http://drupal.org/node/839640', array('%count' => $count, '@signups' => format_plural($count, 'signup', 'signups'))));
+    }
+  }
+
+  return $ret;
+}
\ No newline at end of file
diff --git a/views/uc_signup.module b/views/uc_signup.module
new file mode 100755
index 0000000..fe0a27c
--- /dev/null
+++ b/views/uc_signup.module
@@ -0,0 +1,850 @@
+<?php
+// $Id$
+/*
+ * Implementation of hook_perm().
+ */
+function uc_signup_perm() {
+  return array('administer UC_Signup');
+}
+
+/*
+ * Implementation of hook_menu().
+ */
+function uc_signup_menu() {
+  $items['admin/store/products/signup'] = array(
+    'description' => 'UC_Signup settings',
+    'access arguments' => array('administer UC_Signup'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('uc_signup_settings_form'),
+    'title' => 'Ubercart Signup settings',
+  );
+  $items['uc_signup/attendees/emails'] = array(
+    'access callback' => 'uc_signup_attendees_form_access',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('uc_signup_attendees_form', 2),
+    'title' => 'Attendee E-mail Addresses',
+    'type' => MENU_CALLBACK,
+  );
+  
+  $items['uc_signup/attendees/profiles'] = array(
+    'access callback' => 'uc_signup_attendees_form_access',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('uc_signup_attendees_form', 2),
+    'title' => 'Attendee Contact Information',
+    'type' => MENU_CALLBACK,
+  );
+  
+  return $items;
+}
+
+function uc_signup_attendees_form_access() {
+  return TRUE;
+}
+
+/*
+ * Implementation of hook_theme().
+ */
+function uc_signup_theme() {
+  return array(
+    'uc_signup_user_events' => array(
+      'arguments' => array('events' => array(), $nodes => array()),
+    ),
+    'uc_signup_event_text' => array(
+      'arguments' => array('node' => (object)array(), ),
+    ),
+    'uc_signup_has_account' => array(
+      'arguments' => array('message' => '', ),
+    ),
+    'uc_signup_needs_account' => array(
+      'arguments' => array('message' => '', ),
+    ),
+  );
+}
+
+/*
+ * Implementation of hook_requirements().
+ */
+
+function uc_signup_requirements($phase) {
+  if ($phase == 'runtime') {
+    $requirements['uc_signup']['title'] = t('Signup Integration for Ubercart');
+    $profile_form = uc_signup_profile_form();
+    if (empty($profile_form)) {
+      $requirements['uc_signup']['description'] = t('You have no core user
+        profile fields that are configured to show on the user registration form.
+        UC_Signup requires that you make at !action',
+        array('!action' => l(t('set at least one profile field to appear on the registration form.'), 'admin/user/profile')));
+      $requirements['uc_signup']['severity'] = REQUIREMENT_WARNING;
+    }
+    else {
+      $requirements['uc_signup']['description'] = t('You have at least one core profile field set to show up on the user registration form.');
+      $requirements['uc_signup']['severity'] = REQUIREMENT_OK;
+    }
+  }
+  return $requirements;
+}
+
+/*
+ * Get the profile fields required on user registration.
+ */
+function uc_signup_profile_form() {
+  include_once(drupal_get_path('module', 'user') .'/user.pages.inc');
+  $form = profile_form_profile(array(), (object)array(), NULL, TRUE);
+  // $form now has a fieldset for each profile field category.
+  // We want an array of individual field elements from the first category.
+  $form = array_values($form);
+  $form = $form[0];
+  foreach (element_children($form) as $key => $val) {
+    $new_form[$val] = $form[$val];
+  }
+  return $new_form;
+}
+
+function uc_signup_attendees_form_validate($form, &$form_state) {
+  if ($form_state['storage']['step'] == 'emails') {
+    foreach ($form_state['values'] as $key => $value) {
+      if (is_numeric($key)) {
+        foreach ($form_state['values'][$key] as $num => $mail) {
+          if (!isset($prev_mails[$key])) {
+            $prev_mails[$key] = array();
+          }
+          if (in_array($mail, $prev_mails[$key])) {
+            form_set_error("$key][$num", t("Please enter a unique email address for each event's attendees."));
+          }
+          $prev_mails[$key][] = $mail;
+          if (!valid_email_address($mail)) {
+            form_set_error("$key][$num", t('Please enter a valid email address.'));
+          }
+          if (uc_signup_user_is_signed_up($mail, $key)) {
+            form_set_error("$key][$num", t('The attendee with email address @mail is already signed up for this event', array('@mail' => $mail)));
+          }
+        }
+      }
+    }
+  }
+}
+
+function uc_signup_attendees_form_emails(&$form_state, $events) {
+  $form_state['storage']['step'] = 'emails';
+  global $user;
+
+  foreach ($events as $event) {
+    // TODO: This should call theme('uc_signup_event_text'
+    $node = node_load($event['nid']);
+    //Prepare the formatted CCK Date field.
+    $date_formatted = '';
+    $date_field = signup_date_field($node->type);
+    if (!empty($date_field)) {
+      $date_field_name = $date_field['field_name'];
+      $this_date_field = $node->$date_field_name;
+      $date_formatted = ' - ' . strip_tags(content_format($date_field, $this_date_field[0]));
+    }
+
+    $num = 0;
+    $form['instructions'] = array(
+      '#type' => 'markup',
+      '#value' => t("Please enter the email address of each attendee for this event. If an attendee does not have an account on this site, you'll be prompted to enter some information about that attendee."),
+    );
+    $form[$event['nid']] = array(
+      '#type' => 'fieldset',
+      '#title' => check_plain($node->title) . $date_formatted,
+      '#collapsible' => TRUE,
+      '#collapsed' => FALSE,
+      '#tree' => TRUE,
+    );
+
+    while ($num < $event['qty']) {
+      $default = $form_state['values'][$event['nid']][$num];
+      if (empty($default)) {
+        $default = $_SESSION['uc_signup']['nids'][$event['nid']][$num];
+      }
+      if (empty($default) && $num == 0) {
+        global $user;
+        $account = $user;
+        if (!empty($account->uid) && !uc_signup_user_is_signed_up($account->mail, $event['nid'])) {
+          $default = $account->mail;
+        }
+      }
+      $form[$event['nid']][$num] = array(
+        '#type' => 'textfield',
+        '#title' => t('Email Address of Attendee #%count', array('%count' => $num + 1)),
+        '#default_value' => $default,
+        '#required' => TRUE,
+      );
+      $num ++;
+    }
+  }
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Next step'),
+  );
+  
+  return $form;
+}
+function uc_signup_attendees_form_submit($form, &$form_state) {
+
+  foreach ($form_state['values'] as $key => $value) {
+    if (is_numeric($key)) {
+      $form_state['storage']['uc_signup']['nids'][$key] = $value;
+    }
+    if ($key == 'profile') {
+      $form_state['storage']['uc_signup']['profile'] = $value;
+    }
+  }
+  // Store entered email addresses in the session in case the user navigates away from the form and returns.
+  $_SESSION['uc_signup'] = $form_state['storage']['uc_signup'];
+  if ($form_state['storage']['step'] == 'profiles') {
+    drupal_goto('cart/checkout');
+  }
+
+  if ($form_state['storage']['step'] == 'emails') {
+    unset($form_state['storage']); 
+    $form_state['redirect'] = 'uc_signup/attendees/profiles';
+  }
+}
+function uc_signup_attendees_form(&$form_state = NULL, $menu_path = NULL) {
+  // We have to disable page chaching so that this form works properly for anonymous users.
+  $_SERVER['REQUEST_METHOD'] = 'post';
+  $GLOBALS['config']['cache'] = FALSE;
+
+  $contents = uc_cart_get_contents();
+  foreach ($contents as $product) {
+    if (isset($product->data['uc_signup_enabled']) && $product->data['uc_signup_enabled'] == 1) {
+      $events[$product->nid]['title'] = $product->title;
+      $events[$product->nid]['nid'] = $product->nid;
+      $events[$product->nid]['qty'] = $events[$product->nid]['qty'] + $product->qty;
+    }
+  }
+  // Are there any signup enabled nodes in the cart?
+  if (empty($events)) {
+    // No. Nothing to do here.
+    drupal_goto('cart/checkout');
+  }
+
+  if (empty($form_state['storage']['uc_signup'])) {
+    $form_state['storage']['uc_signup'] = $_SESSION['uc_signup'];
+  }
+
+  //At this point, if the user requested the emails form, present it.
+  if (!empty($menu_path) && $menu_path == 'emails') {
+    return uc_signup_attendees_form_emails($form_state, $events);
+  }
+
+  // Is there a full list of emails for attendees attending each event that matches the event's quantity in the cart?
+  $emails_needed = 0;
+  foreach ($events as $event) {
+    $nid = $event['nid'];
+    if ($event['qty'] > count($form_state['storage']['uc_signup']['nids'][$nid])) {
+      $emails_needed ++;
+    }
+  }
+
+  // If not, redirect to the email address form.
+  if ($emails_needed > 0) {
+    drupal_goto('uc_signup/attendees/emails');
+  }
+
+  //Otherwise, the user is requesting the profiles form.
+   return uc_signup_attendees_form_profiles($form_state, $events);
+}
+
+function uc_signup_attendees_form_profiles(&$form_state, $events = array()) {
+  $form_state['storage']['step'] = 'profiles';
+  $mails = array();
+  $nodes = array();
+  // Build an array keyed on email addresses
+  foreach ($form_state['storage']['uc_signup']['nids'] as $nid => $attendees) {
+    if (!in_array($nid, $nodes)) {
+      // Prepare node obejcts so we can display date information.
+      $nodes[$nid] = node_load($nid);
+    }
+    foreach ($attendees as $key => $mail) {
+      if (is_numeric($nid)) {
+        $mails[$mail][] = $nid;
+      }
+    }
+  }
+
+  $profile_form = uc_signup_profile_form();
+  $mail = '';
+  foreach ($mails as $mail => $events) {
+    $form[$mail] = array(
+      '#type' => 'fieldset',
+      '#title' => check_plain($mail),
+      '#collapsible' => TRUE,
+      '#collapsed' => FALSE,
+    );
+
+    $form[$mail]['events'] = array(
+      '#type' => 'markup',
+      '#value' => theme('uc_signup_user_events', $events, $nodes),
+    );
+
+    // Is there an account for this email address?
+    $account = user_load(array('mail' => $mail));
+    if (empty($account->uid)) {
+      $profile_form = uc_signup_profile_form();
+      if (!empty($profile_form)) {
+        $form[$mail]['profile'] = $profile_form;
+        foreach ($form[$mail]['profile'] as $key => $value) {
+          $default = $form_state['values']['profile'][$key .'_'. $mail];
+          if (empty($default)) {
+            $default = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
+          }
+          if ($key[0] != '#') {
+            $form[$mail]['profile'][$key .'_'. $mail] = $value;
+            unset($form[$mail]['profile'][$key]);
+            $form[$mail]['profile'][$key .'_'. $mail]['#default_value'] = $default;
+            $form[$mail]['profile']['#tree'] = TRUE;
+          }
+          drupal_add_css(drupal_get_path('module', 'uc_signup') .'/uc_signup.css');
+          $form[$mail]['has_account'] = array(
+            '#type' => 'markup',
+            '#value' => theme('uc_signup_needs_account', t('Please enter additional information about this attendee.')),
+            '#weight' => -4,
+          );
+        }
+      }
+    }
+    else {
+      drupal_add_css(drupal_get_path('module', 'uc_signup') .'/uc_signup.css');
+      $form[$mail]['has_account'] = array(
+        '#type' => 'markup',
+        '#value' => theme('uc_signup_has_account', t('We already have contact information for this attendee in our system.')),
+        '#weight' => -4,
+      );
+    }
+  }
+
+  $form['back'] = array(
+    '#type' => 'markup',
+    '#value' => l(t("Previous step"), 'uc_signup/attendees/emails'),
+  );
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Next step'),
+    '#attributes' => array('class' => 'uc_signup_next'),
+  );
+
+  return $form;
+}
+
+function theme_uc_signup_needs_account($message = '') {
+  return '<span class="uc_signup_needs_account">'. $message .'</span>';
+}
+
+function theme_uc_signup_has_account($message = '') {
+  return '<span class="uc_signup_has_account">'. $message .'</span>';
+}
+
+function theme_uc_signup_user_events($events = array(), $nodes = array()) {
+  foreach ($events as $key => $nid) {
+    $list[$nid] = theme('uc_signup_event_text', $nodes[$nid]);
+  }
+
+  $output .= '<div class="uc_signup_user_events">';
+  $output .= '<span class="uc_signup_attending">'. t('Attending:') .'</span>';
+  $output .= theme('item_list', $list);
+  $output .= '</div>';
+  return $output;
+}
+
+function theme_uc_signup_event_text($node = NULL) {
+  $date_field = signup_date_field($node->type);
+  if (!empty($date_field)) {
+    $date_field_name = $date_field['field_name'];
+    $this_date_field = $node->$date_field_name;
+    $date_formatted = ' - ' . content_format($date_field, $this_date_field[0]);
+  }
+
+  return check_plain($node->title) . $date_formatted;
+}
+
+/*
+ * Implementation of hook_signup_suppress.
+ * Prevent the Signup from appearing on non-free signup-enabled nodes.
+ */
+function uc_signup_signup_suppress($node) {
+  if (isset($node->sell_price) && $node->sell_price > 0) {
+    return TRUE;
+  }
+}
+
+/*
+ * Implementation of hook_nodeapi().
+ * Prevent the Signup from appearing on non-free signup-enabled nodes.
+ */
+function uc_signup_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
+  switch ($op) {
+    case 'view':
+      if (isset($node->sell_price) && $node->sell_price > 0) {
+        unset($node->content['signup']);
+      }
+  }
+}
+
+/*
+ * Implementation of hook_form_alter().
+ */
+function uc_signup_form_alter(&$form, &$form_state, $form_id) {
+  if ($form_id == 'uc_cart_checkout_form') {
+    global $user;
+    if (!$user->uid && !empty($_SESSION['uc_signup']['nids'])) {
+      foreach ($_SESSION['uc_signup']['nids'] as $key => $attendees) {
+        $form['panes']['customer']['primary_email']['#default_value'] = $_SESSION['uc_signup']['nids'][$key][0];
+        break;
+      }
+    }
+  }
+  if (strpos($form_id, 'uc_product_add_to_cart_form') !== FALSE || strpos($form_id, 'uc_catalog_buy_it_now_form') !== FALSE) {
+    $node = $form['#parameters']['2'];
+    if (isset($node->signup) && $node->signup == 1) {
+      $add_cart_text = variable_get('uc_signup_add_cart_text', 'Sign up');
+      if ($add_cart_text != '') {
+        $form['submit']['#value'] = t($add_cart_text);
+        $node = $form['#parameters'][2];
+        _uc_signup_node_available($node, 0 , $message);
+        if ($message) {
+          $form['submit']['#value'] = $message;
+          $form['submit']['#disabled'] = TRUE;
+          if (isset($form['qty'])) {
+            $form['qty']['#disabled'] = TRUE;
+          }
+        } 
+      }
+
+      //The quantity field is not always enabled on this form.
+      if (!empty($form['qty'])) {
+        $form["#validate"][] = 'uc_signup_product_add_to_cart_form_validate';
+      }
+    }
+  }
+  if ($form_id == 'uc_cart_view_form') {
+    $form['#validate'][] = 'uc_signup_cart_view_form_validate';
+    $form['checkout']['#submit'][] = 'uc_signup_cart_view_form_submit';
+    $form['update']['#submit'][] = 'uc_signup_cart_view_form_submit';
+  }
+}
+
+function uc_signup_cart_view_form_submit($form, &$form_state) {
+  if (!empty($form_state['values']['items'])) {
+    foreach ($form_state['values']['items'] as $item) {
+      if ($item['remove']) {
+        unset($_SESSION['uc_signup']['nids'][$item['nid']]);
+      }
+      if ($item['qty'] <  count($_SESSION['uc_signup']['nids'][$item['nid']])) {
+        array_splice($_SESSION['uc_signup']['nids'][$item['nid']], $item['qty']);
+      }
+    }
+  }
+}
+
+function uc_signup_product_add_to_cart_form_validate($form, &$form_state) {
+  $node = node_load($form_state['values']['nid']);
+  _uc_signup_node_available($node, $form_state['values']['qty'], $message);
+  if ($message) {
+    form_set_error('qty', $message);
+  }
+}
+
+function uc_signup_cart_view_form_validate($form, $form_state) {
+  if (!empty($form_state['values']['items'])) {
+    foreach ($form_state['values']['items'] as $key => $item) {
+      $data = unserialize($item['data']);
+      if (!($form_state['values']['items'][$key]['remove'] == 1 || $form_state['values']['items'][$key]['qty'] == 0) && isset($data['uc_signup_enabled']) && $data['uc_signup_enabled'] == 1) {
+        $node = node_load($item['nid']);
+        _uc_signup_node_available($node, $item['qty'], $message);
+        if ($message) {
+          form_set_error("items][$key][qty", $message);
+        }
+      }
+    }
+  }
+}
+
+
+/*
+ * Implementation of hook_ca_predicate().
+ */
+function uc_signup_ca_predicate() {
+  $configurations['uc_signup_mark_paid'] = array(
+    '#title' => t('Change temporary signups to paid signups upon checkout when a payment clears the order balance.'),
+    '#description' => t('Change temporary signups to paid signups upon checkout when a payment clears the order balance.'),
+    '#class' => 'uc_signup',
+    '#trigger' => 'uc_payment_entered',
+    '#status' => 1,
+    '#conditions' => array(
+      '#operator' => 'AND',
+      '#conditions' => array(
+        array(
+          '#name' => 'uc_payment_condition_order_balance',
+          '#title' => t('If the balance is less than or equal to $0.00.'),
+          '#argument_map' => array(
+            'order' => 'order',
+          ),
+          '#settings' => array(
+            'negate' => FALSE,
+            'balance_comparison' => 'less_equal',
+          ),
+        ),
+      ),
+    ),
+    '#actions' => array(
+      array(
+        '#name' => 'uc_signup_mark_paid',
+        '#title' => t('Mark temporary signups created by UC_Signup as paid'),
+        '#argument_map' => array(
+           'order' => 'order',
+        ),
+        '#settings' => array(),
+      ),
+    ),
+  );
+
+  $configurations['uc_signup_cancel_signups'] = array(
+    '#title' => t('Cancel temporary signups created by UC_Signup when an order is cancelled'),
+    '#description' => t('Cancels temporary signups and removes the corresponding data from the and uc_signup_log table.'),
+    '#class' => 'uc_signup',
+    '#trigger' => 'uc_checkout_complete',
+    '#status' => 1,
+    '#conditions' => array(
+      '#operator' => 'AND',
+      '#name' => 'uc_order_status_condition',
+      '#title' => t('Check the order status'),
+      '#argument_map' => array(
+        'order' => 'updated_order',
+      ),
+      '#settings' => array(
+        'negate' => FALSE,
+        'order_status' => 'canceled',
+      ),
+    ),
+    '#actions' => array(
+      array(
+        '#name' => 'uc_signup_cancel_signups',
+        '#title' => t('Cancel temporary signups created by UC_Signup'),
+        '#argument_map' => array(
+          'order' => 'order',
+        ),
+        '#settings' => array(
+        ),
+      ),
+    ),
+  );
+  return $configurations;
+}
+
+/*
+ * Implementation of hook_ca_action().
+ */
+function uc_signup_ca_action() {
+  $order_arg = array(
+    '#entity' => 'uc_order',
+    '#title' => t('Order'),
+  );
+  $actions['uc_signup_cancel_signups'] = array(
+    '#title' => t('Cancel temporary signups for the current user'),
+    '#category' => t('uc_signup'),
+    '#callback' => 'uc_signup_cancel_temporary_signups',
+    '#arguments' => array(
+      'order' => $order_arg,
+     ),
+  );
+  $actions['uc_signup_mark_paid'] = array(
+   '#title' => t('Mark temporary signups as paid'),
+    '#category' => t('uc_signup'),
+    '#callback' => 'uc_signup_mark_paid',
+    '#arguments' => array(
+      'order' => $order_arg,
+    ),
+  );
+  return $actions;
+}
+
+/**
+ * Implementation of hook_checkout_pane().
+ */
+function uc_signup_checkout_pane() {
+  $panes[] = array(
+    'id' => 'uc_signup_attendees_pane',
+    'callback' => 'uc_signup_attendees_pane',
+    'title' => t('Attendee Signup Information'),
+    'desc' => t("Displays entered attendee information for events in the cart, or redirects to the form where that data is entered."),
+    'weight' => -10,
+    'enabled' => TRUE,
+    'process' => FALSE,
+  );
+  return $panes;
+}
+
+/**
+ * Callback for uc_signup_checkout_pane.
+ */
+function uc_signup_attendees_pane($op, $arg1, $arg2) {
+  switch ($op) {
+    case 'view':
+      $contents = uc_cart_get_contents();
+      foreach ($contents as $product) {
+        if (isset($product->data['uc_signup_enabled']) && $product->data['uc_signup_enabled'] == 1) {
+          $signups = TRUE;
+        }
+        if ($signups && $product->data['uc_signup_enabled'] && (empty($_SESSION['uc_signup']['nids'][$product->nid]) || count($_SESSION['uc_signup']['nids'][$product->nid]) < $product->qty)) {
+          // TODO: make it impossible to rediret infinitely.
+          drupal_goto('uc_signup/attendees/emails');
+        }
+      }
+      $mails = array();
+      $nodes = array();
+      if (!empty($_SESSION['uc_signup']['nids'])) {
+        foreach ($_SESSION['uc_signup']['nids'] as $nid => $attendees) {
+          if (!in_array($nid, $nodes)) {
+            // Prepare node obejcts so we can display date information.
+            $nodes[$nid] = node_load($nid);
+          }
+          foreach ($attendees as $key => $mail) {
+            $mails[$mail][] = $nid;
+          }
+        }
+      
+        foreach ($mails as $mail => $events) {
+          $output .= "<div>";
+          $output .= $mail;
+          $output .= theme('uc_signup_user_events', $events, $nodes);
+          $output .= "</div>";
+        }
+        $output .= l(t('Edit signup information'), 'uc_signup/attendees/emails', array('attributes' => array('class' => 'uc_signup_edit_info')));
+        $pane['uc_signup'] = array(
+          '#value' => $output,
+          '#weight' => variable_get('uc_pane_cart_field_cart_weight', 2),
+        );
+        return array('contents' => $pane, 'next-button' => FALSE);
+      }
+      return;
+  }
+}
+
+/**
+ * Implementation of hook_order_pane().
+ */
+function uc_signup_order_pane() {
+  $panes[] = array(
+    'id' => 'uc_signup_info',
+    'callback' => 'uc_signup_info_pane',
+    'title' => t('Event Signup Information'),
+    'desc' => t(""),
+    'class' => 'pos-left',
+    'weight' => 1,
+    'show' => array('customer', 'view'),
+  );
+  return $panes;
+}
+
+/**
+ * Implementation of hook_order().
+ */
+function uc_signup_order($op, &$arg1, $arg2) {
+  switch ($op) {
+    case 'submit':
+      foreach ($arg1->products as $product) {
+        if (isset($product->data['uc_signup_enabled']) && $product->data['uc_signup_enabled'] == 1) {
+          $events_to_signup[] = $product;
+        }
+      }
+      if (!empty($events_to_signup)) {
+        //Clear any existing placeholder signups before proceeding.
+        uc_signup_cancel_temporary_signups($arg1);
+        foreach ($_SESSION['uc_signup']['nids'] as $nid => $attendees) {
+          foreach ($attendees as $key => $mail) {
+            $account = user_load(array('mail' => $mail));
+            // We must provide a default password
+            // or the form will fail to validate.
+            $random_password = user_password(8);
+            if (empty($account->uid)) {
+              $form_state['values']['mail'] = $mail;
+              $form_state['values']['name'] = uc_store_email_to_username($mail);
+              $form_state['values']['op'] = t('Create new account');
+              $form_state['values']['pass']['pass1'] = $random_password;
+              $form_state['values']['pass']['pass2'] = $random_password;
+              $form_state['values']['notify'] = (bool)variable_get('uc_signup_account_notify', 1);
+              $profile_form =  uc_signup_profile_form();
+              foreach ($profile_form as $key => $value) {
+                $form_state['values'][$key] = $_SESSION['uc_signup']['profile'][$key .'_'. $mail];
+              }
+              
+              //We masquerade as user 1 in case there is captcha or other protection on the user_register form that could cause submission to fail.
+              global $user;
+              $temp_user = $user;
+              //Always set this to false in case the operation fails.
+              session_save_session(FALSE);
+              $user = user_load(1);
+              drupal_execute('user_register', $form_state);
+              $user = $temp_user;
+              session_save_session(TRUE);
+              $account = $form_state['user'];
+              if (!$account->uid) {
+                uc_signup_cancel_temporary_signups($arg1);
+                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;
+          }
+        }
+        unset($nid);
+        foreach ($to_signup as $nid => $uids) {
+          //Perform the final verification that the node is available for signups in the desired quantity.
+          //Note that we do not pass the quantity in order to avoid our own placeholder signups from counting against the number of available spots.
+          $node = node_load($nid);
+          _uc_signup_node_available($node, 0, $message);
+          if ($message) {
+            uc_signup_cancel_temporary_signups($arg1);
+            return array(array('pass' => FALSE, 'message' => t($message)));
+          }
+          foreach ($uids as $key => $uid) {
+            uc_signup_create_placeholder_signup($nid, $uid, $arg1->order_id);
+          }
+        }
+      }
+  }
+}
+
+
+/*
+ * Create a placeholder signup for a user.
+ */
+function uc_signup_create_placeholder_signup($nid, $uid, $oid) {
+  $mail = 'placeholder-' . rand(111111, 99999) . '@example.com';
+  $signup_form = array(
+    'uid' => 0,
+    'signup_anon_mail' => $mail,
+    'nid' => $nid,
+  );
+  $sid = signup_sign_up_user($signup_form, FALSE);
+  if (is_numeric($sid)) {
+    db_query("INSERT INTO {uc_signup_log} (oid, sid, type, uid) VALUES (%d, %d, %d, %d)", $oid, $sid, 0, $uid);
+  }
+}
+
+function uc_signup_mark_paid($order, $settings = array()) {
+  static $accounts = array();
+  $nodes = array();
+  // TODO: save this in the order.
+  $signups = _uc_signup_get_temporary_signups($order);
+  if (is_array($signups)) {
+    foreach ($signups as $signup) {
+      if (!isset($nodes[$signup->nid])) {
+        $nodes[$signup->nid] = node_load($signup->nid);
+      }
+      // Assign the signup to the appropriate account.
+      $signup->anon_mail = ''; 
+      // The uid is added to $signup by _uc_signup_get_temporary_signups() but has not been saved to signup_log.
+      signup_save_signup($signup);
+      // We haven't done a signup_load(), which populates $signup->mail, so we provide it here.
+      if (empty($accounts[$signup->uid])) {
+        $accounts[$signup->uid] = user_load($signup->uid);  
+      }
+      $signup->mail = $accounts[$signup->uid]->mail;
+      db_query("UPDATE {uc_signup_log} SET type = 1 WHERE sid = %d", $signup->sid);
+      if ($nodes[$signup->nid]->signup_send_confirmation) {
+        signup_send_confirmation_mail($signup, $nodes[$signup->nid]);
+      }
+      //Signup.module checks for $node->signup_forwarding_email for us.
+      signup_send_forwarding_mail($signup, $nodes[$signup->nid]);
+      
+      unset($account);
+      unset($signup);
+    }
+  }
+
+  unset($_SESSION['uc_signup']);
+}
+
+function _uc_signup_node_available($node, $qty, &$message) {
+  $type_name = db_result(db_query("SELECT name from {node_type} WHERE type = '%s'", $node->type));
+
+  if (!$node->signup_status) {
+    $message = t(variable_get('uc_signup_signups_closed_text', "Signups are closed for this event."));
+  }
+  if (_signup_node_completed($node)) {
+    $message = t("We're sorry, but the @type %title has already passed.", array('@type' => $type_name, '%title' => $node->title));
+  }
+  if ($node->signup_close_signup_limit !=0) {
+    $spots_remaining = $node->signup_close_signup_limit - $node->signup_total;
+    if ($spots_remaining > 0) {
+      $only = 'only ';
+    }
+    if ($spots_remaining < $qty) {
+      $message = t("We're sorry, but there @is $only@available @spot left for the @type %title.", array(
+        '@is' => format_plural($spots_remaining, "is", "are"),
+        '@spot' => format_plural($spots_remaining, "spot", "spots"),
+        '@available' => $spots_remaining,
+        '@type' => $type_name,
+        '%title' => $node->title
+      ));
+    }
+  }
+}
+
+function uc_signup_settings_form() {
+  $form['uc_signup_add_cart_text'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Add to cart text'),
+    '#description' => t("The text to use to add the signup-enabled node to the cart. If left blank, Ubercart's default 'Add to cart' text will be used."),
+    '#default_value' => variable_get('uc_signup_add_cart_text', 'Sign up'),
+  );
+  $form['uc_signup_signups_closed_text'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Signups closed text'),
+    '#description' => t("The signup/add to cart button will be disabled and display this text when signups are closed for a node. This text will be displayed when capacity is reached for an event."),
+    '#default_value' => variable_get('uc_signup_signups_closed_text', t("Signups are closed for this event.")),
+  );
+  
+  $form['uc_signup_account_notify'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Send account notification emails when accounts are created'),
+    '#description' => t("When enabled account activation emails will be sent when uc_signup automatically creates accounts."),
+    '#default_value' => variable_get('uc_signup_account_notify', 1),
+  );
+  return system_settings_form($form);
+}
+
+function uc_signup_user_is_signed_up($mail, $nid) {
+  $sid = db_result(db_query("SELECT sl.sid FROM {signup_log} sl INNER JOIN {users} u on u.uid = sl.uid WHERE u.mail = '%s' AND sl.nid = %d", $mail, $nid));
+  if (!is_numeric($sid)) {
+    return FALSE;
+  }
+  else {
+    return $sid;
+  }
+}
+
+function uc_signup_cancel_temporary_signups($order, $settings = array()) {
+  $signups = _uc_signup_get_temporary_signups($order);
+  if (!empty($signups)) {
+    foreach ($signups as $signup) {
+      signup_cancel_signup($signup);
+      db_query("DELETE FROM {uc_signup_log} WHERE sid = %d", $signup->sid);
+    }
+  }
+}
+
+function _uc_signup_get_temporary_signups($order) {
+  $query = db_query("SELECT sl.*, ucl.uid FROM {signup_log} sl INNER JOIN {uc_signup_log} ucl ON ucl.sid = sl.sid WHERE ucl.oid = %d AND ucl.type = 0", $order->order_id);
+  while ($result = db_fetch_object($query)) {
+    $signups[$result->sid] = $result;
+  }
+  return $signups;
+}
+
+function uc_signup_add_to_cart_data($form_values) {
+  $node = node_load($form_values['nid']);
+  if ($node->signup == 1) {
+    return array('uc_signup_enabled' => 1);
+  }
+}
+
+function uc_signup_views_api() {
+  return array(
+    'api' => 2.0,
+    'path' => drupal_get_path('module', 'uc_signup') .'/views',
+  );
+}
diff --git a/views/uc_signup.views.inc b/views/uc_signup.views.inc
old mode 100644
new mode 100755
index d1b28c3..965031f
--- a/views/uc_signup.views.inc
+++ b/views/uc_signup.views.inc
@@ -1,4 +1,5 @@
 <?php
+// $Id$
 
 /*
  * Implementation of hook_views_data().
diff --git a/views/uc_signup.views_default.inc b/views/uc_signup.views_default.inc
old mode 100644
new mode 100755
diff --git a/views/uc_signup_field_signup_order_handler.inc b/views/uc_signup_field_signup_order_handler.inc
old mode 100644
new mode 100755
index 35a95e4..09c80dd
--- a/views/uc_signup_field_signup_order_handler.inc
+++ b/views/uc_signup_field_signup_order_handler.inc
@@ -1,4 +1,5 @@
 <?php 
+// $Id$
 class uc_signup_field_signup_order_handler extends views_handler_field {
   function render($values) {
     return l($values->uc_signup_log_oid, 'admin/store/orders/'. $values->uc_signup_log_oid);
