? bio-fields-on-registration-182266-3.patch
? bio.module-151572.patch
Index: bio.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/bio/bio.module,v
retrieving revision 1.2.2.12
diff -u -p -r1.2.2.12 bio.module
--- bio.module	3 Jul 2007 18:28:09 -0000	1.2.2.12
+++ bio.module	29 Nov 2007 01:03:15 -0000
@@ -62,11 +62,25 @@ function bio_menu($may_cache) {
 }
 
 /**
- * Implementation of hook_form_alter
- * 
- * Handle the 
+ * Implementation of hook_form_alter().
  */
 function bio_form_alter($form_id, &$form) {
+  // Add option on bio CCK fields to show field on user registration form.
+  if ($form_id == '_content_admin_field' && $form['type_name']['#value'] == variable_get('bio_nodetype', 'bio')) {
+    $field_name = check_plain($form['field_name']['#value']);
+    $form['field']["bio_registration_$field_name"] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Registration form'),
+      '#options' => array(1 => t('Visible in user registration form')),
+    );
+    // This is kind of crappy, but doesn't seem to work otherwise.
+    if (variable_get("bio_registration_$field_name", 0)) {
+      $form['field']["bio_registration_$field_name"]['#default_value'][] = 1;
+    }
+    
+    $form['#submit']['bio_cck_field_settings_submit'] = array();
+  }
+
   if ($form_id == variable_get('bio_nodetype', 'bio') ."_node_form" && arg(0) == 'user') {
     // we're editing the bio in the user area... be sure we end up here when we finish submission
     $account = user_load(array('uid' => arg(1)));
@@ -81,6 +95,14 @@ function bio_form_alter($form_id, &$form
   }
 }
 
+/**
+ * Submit handler for CCK field form. Sets registration form option.
+ */
+function bio_cck_field_settings_submit($form_id, $form_values) {
+  $field_name = check_plain($form_values['field_name']);
+  variable_set("bio_registration_$field_name", $form_values["bio_registration_$field_name"][1]);
+}
+
 function bio_profile_alter(&$account, &$fields) {
   if (variable_get('bio_profile_takeover', 0) && $bio = bio_for_user($account->uid)) {
     $bio = node_load($bio);
