Index: rpx.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/rpx/Attic/rpx.admin.inc,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 rpx.admin.inc
--- rpx.admin.inc	13 Jun 2010 12:57:14 -0000	1.1.2.7
+++ rpx.admin.inc	17 Aug 2010 19:15:51 -0000
@@ -285,6 +285,7 @@
 }
 
 function rpx_profile_settings_form($form_state) {
+  $options = array();
   
   $form['rpx_import_profile_photo'] = array(
     '#type' => 'checkbox',
@@ -294,19 +295,44 @@
   );
 
   if (module_exists('profile')) {
+    $modules['profile'] = t('Profile');
     $options = _rpx_profile_field_options();
   }
+
+
+  if (module_exists('content_profile_registration')) {
+    $modules['content_profile'] = t('Content Profile Registration');
+    foreach (content_profile_get_types() as $type => $info) {
+      $node_form = array();
+      $settings = content_profile_get_settings($type);
+      // check if node type is configured to show on registration page
+      if ($settings['registration_use']) {
+        $options += _rpx_content_profile_field_options($type);
+      }
+    }
+  }
+
+  if (sizeof($modules)) {
+    $form['rpx_profile_module'] = array(
+      '#type' => 'select',
+      '#title' => t('Profile module'),
+      '#description' => t('Select which module you use for profiles.'),
+      '#options' => $modules,
+      '#default_value' => variable_get('rpx_profile_module', '') ? variable_get('rpx_profile_module', '') : '',
+    );
+  }
   else {
-    // If the profile module is not enabled, notify the user
+    // If the profile and content profile module are not enabled, notify the user
     if (!count($form_state['post']))
-      drupal_set_message(t('The profile module must be enabled to map RPX data to profile fields.'));
+      drupal_set_message(t('The profile or content profile registration module must be enabled to map RPX data to profile fields.'));
     $options = array();
   }
+
   $map = variable_get('rpx_profile_fields_map', array());
   $form['mapping'] = array(
       '#type' => 'fieldset',
       '#title' => t('Field Mapping'),
-      '#description' => t('<p>Select the Drupal profile fields that should be mapped to RPX data. Currently only 3 Drupal profile field types are supported: single-line text, multi-line text, and URL.</p>'),
+      '#description' => t('<p>Select the Drupal profile fields that should be mapped to RPX data. Currently only 3 Drupal profile field types are supported: single-line text, multi-line text, and URL. If you are using content profile module, the following field types are supported: text, date.</p>'),
       '#tree' => TRUE
   );
   $form['mapping']['givenName'] = array(
@@ -381,6 +407,16 @@
   return $form;
 }
 
+function _rpx_content_profile_field_options($type) {
+  $options = array('' => '');
+  $result = db_query('SELECT field_name, label FROM {content_node_field_instance} WHERE widget_type IN ("text_textfield", "text_textarea", "optionwidgets_select", "optionwidgets_buttons", "date_popup", "date_select") AND type_name = "%s" ORDER BY weight, label', array($type));
+  while ($row = db_fetch_object($result)) {
+    $options[$row->field_name] = $row->label;
+  }
+
+  return $options;
+}
+
 function _rpx_profile_field_options() {
   $options = array('' => '');
   $result = db_query('SELECT fid, title, name FROM {profile_fields} WHERE type IN ("textfield", "textarea", "url") ORDER BY weight, title');
@@ -394,6 +430,7 @@
 function rpx_profile_settings_form_submit($form_state, $form_values) {
   $values = $form_values['values'];
   variable_set('rpx_import_profile_photo', $values['rpx_import_profile_photo']);
+  variable_set('rpx_profile_module', $values['rpx_profile_module']);
   $map = array();
   foreach ($values['mapping'] as $k => $v) {
     if ($v) {
Index: rpx.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/rpx/rpx.info,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 rpx.info
--- rpx.info	28 Mar 2010 22:58:24 -0000	1.2.2.1
+++ rpx.info	17 Aug 2010 19:15:52 -0000
@@ -3,3 +3,10 @@
 description = Adds the RPX Sign In widget to your site
 core = 6.x
 php = 5.2
+
+; Information added by drupal.org packaging script on 2010-06-16
+version = "6.x-1.3"
+core = "6.x"
+project = "rpx"
+datestamp = "1276692609"
+
Index: rpx.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/rpx/rpx.module,v
retrieving revision 1.8.2.52
diff -u -r1.8.2.52 rpx.module
--- rpx.module	13 Jun 2010 05:01:30 -0000	1.8.2.52
+++ rpx.module	17 Aug 2010 19:15:52 -0000
@@ -195,6 +195,29 @@
     }
     $form = array_merge($form, $extra);
   }
+
+  // check other module's implemenation of hook_form_alter() on user register form and implement
+  // here if 'force reg form' variable is set
+  if (variable_get('rpx_force_registration_form', 0)) {
+    $form_id = 'user_register';
+    $form_state = array();
+
+    // The rest of this if clause is copied from includes/form.inc in drupal 6.17
+    // Normally, we would call drupal_alter($form_id, $form, $form_state).
+    // However, drupal_alter() normally supports just one byref parameter. Using
+    // the __drupal_alter_by_ref key, we can store any additional parameters
+    // that need to be altered, and they'll be split out into additional params
+    // for the hook_form_alter() implementations.
+    // @todo: Remove this in Drupal 7.
+    $data = &$form;
+    $data['__drupal_alter_by_ref'] = array(&$form_state);
+    drupal_alter('form_'. $form_id, $data);
+    
+    // __drupal_alter_by_ref is unset in the drupal_alter() function, we need
+    // to repopulate it to ensure both calls get the data.
+    $data['__drupal_alter_by_ref'] = array(&$form_state);
+    drupal_alter('form', $data, $form_id);
+  }
  
   return $form;
 }
@@ -277,6 +300,7 @@
     _user_mail_notify('register_pending_approval', $account);
     drupal_set_message(t('Your account must be approved by an administrator before you are able to login to the site.'));
   }
+  $form_state['user'] = $account;
 }
 
 function rpx_end_point() {
@@ -586,6 +610,36 @@
         $form = _rpx_update_user_login_form($form, $form_state);
       }
   }
+
+  // need to do some alters for content profile node types on rpx registration form
+  if ($form_id == 'rpx_registration' && variable_get('rpx_profile_module', '') == 'content_profile') {
+    static $map;
+    if (! $map) {
+      $map = variable_get('rpx_profile_fields_map', array());
+      // flip array to use Drupal profile field as key and RPX field as value
+      $map = array_flip($map);
+    }
+    $default_types = content_profile_get_types('names', 'registration_use');
+    foreach ($default_types as $type => $label) {
+      foreach ($map as $field_name => $rpx_name) {
+        if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type, $field_name))) { 
+          $thisfield =& $form[$group_name][$field_name];
+        }
+        else {
+          $thisfield =& $form[$field_name];
+        }
+        switch ($thisfield['#type']) {
+          case 'optionwidgets_buttons':
+          case 'optionwidgets_select':
+            $thisfield['#default_value'][0]['value'] = _rpx_data_map($_SESSION['rpx'], $rpx_name);
+            break;
+          default:
+            $thisfield[0]['#default_value']['value'] = _rpx_data_map($_SESSION['rpx'], $rpx_name);
+            break;
+        }
+      }
+    }
+  }
   return $form;
 }
 
