? content_profile_registration_filter.patch
Index: content_profile_registration.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_profile/modules/Attic/content_profile_registration.module,v
retrieving revision 1.1.2.25
diff -u -p -r1.1.2.25 content_profile_registration.module
--- content_profile_registration.module	7 Jan 2009 11:02:28 -0000	1.1.2.25
+++ content_profile_registration.module	20 Feb 2009 14:35:20 -0000
@@ -14,39 +14,45 @@ function content_profile_registration_fo
   if ($form_id == 'user_register' && module_exists('content') && arg(0) != 'admin') {
     require_once drupal_get_path('module', 'node') .'/node.pages.inc';
     $profile_types = content_profile_get_types('names', 'registration_use');
+
     $form += array('#field_info' => array());
 
+
     foreach ($profile_types as $type => $typename) {
-      // Initialize new node:
-      $node = array('uid' => 0, 'name' => '', 'type' => $type);
-      // Get the node form
-      $node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node);
-      drupal_prepare_form($type .'_node_form', $node_form, $form_state);
-
-      $form['#field_info'] += $node_form['#field_info'];
-      foreach ($node_form['#field_info'] as $field_name => $info) {
-        $form[$field_name] = $node_form[$field_name];
-      }
+      $display = FALSE;
+      $filter = content_profile_get_settings($type, 'registration_filter');
+      if($display) {
+        // Initialize new node:
+        $node = array('uid' => 0, 'name' => '', 'type' => $type);
+        // Get the node form
+        $node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node);
+        drupal_prepare_form($type .'_node_form', $node_form, $form_state);
+
+        $form['#field_info'] += $node_form['#field_info'];
+        foreach ($node_form['#field_info'] as $field_name => $info) {
+          $form[$field_name] = $node_form[$field_name];
+        }
 
-      $keys = array_keys($node_form);
-      foreach ($keys as $key) {
-        if (stristr($key, 'group_')) {
-          $form[$key] = $node_form[$key];
+        $keys = array_keys($node_form);
+        foreach ($keys as $key) {
+          if (stristr($key, 'group_')) {
+            $form[$key] = $node_form[$key];
+          }
         }
-      }
 
-      // Set this to the values of one node, as it might be need by some #ahah callbacks
-      $form['#node'] = $node_form['#node'];
-      $form['type'] = $node_form['type'];
-
-      // Hide fields
-      foreach (content_profile_get_settings($type, 'registration_hide') as $field_name) {
-        $form[$field_name]['#access'] = FALSE;
+        // Set this to the values of one node, as it might be need by some #ahah callbacks
+        $form['#node'] = $node_form['#node'];
+        $form['type'] = $node_form['type'];
+
+        // Hide fields
+        foreach (content_profile_get_settings($type, 'registration_hide') as $field_name) {
+          $form[$field_name]['#access'] = FALSE;
+        }
+      }
+      if ($profile_types) {
+        $form['#submit'][] = 'content_profile_registration_user_register_submit';
+        $form['#validate'][] = 'content_profile_registration_user_register_validate';
       }
-    }
-    if ($profile_types) {
-      $form['#submit'][] = 'content_profile_registration_user_register_submit';
-      $form['#validate'][] = 'content_profile_registration_user_register_validate';
     }
   }
   elseif ($form_id == 'content_profile_admin_settings') {
@@ -57,6 +63,7 @@ function content_profile_registration_fo
       '#description' => t('Customize how this content profile shows up on the user registration page.'),
       '#collapsible' => TRUE,
     );
+
     $options = _content_profile_registration_get_field_select($type);
     if (!empty($options)) {
       $form['registration']['registration_use'] = array(
@@ -65,15 +72,20 @@ function content_profile_registration_fo
         '#description' => t('Use this content type on the user registration page'),
         '#default_value' => content_profile_get_settings($type, 'registration_use'),
       );
-      $options = _content_profile_registration_get_field_select($type, FALSE);
-      if (!empty($options)) {
-        $form['registration']['registration_hide'] = array(
+
+      $form['registration']['registration_filter'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Filter Registration'),
+        '#description' => t('This content type will only be displayed if the url argument contains following filterword. Only use 1 argument'),
+        '#default_value' => content_profile_get_settings($type, 'registration_filter'),
+      );
+
+      $form['registration']['registration_hide'] = array(
           '#type' => 'checkboxes',
           '#title' => t('Hide these fields during registration'),
           '#options' => $options,
           '#default_value' => content_profile_get_settings($type, 'registration_hide'),
-        );
-      }
+      );
     }
     else {
       $help = t('There are no fields defined, so registration integration is disabled.');
@@ -106,7 +118,7 @@ function _content_profile_registration_g
  *   if it's NULL all fields will be returned.
  * @return Array
  *   An array of fields suitable for use in a select field.
-*/
+ */
 function _content_profile_registration_get_field_select($type, $required = NULL) {
   $fields = _content_profile_registration_get_fields($type);
   $return = array();
@@ -170,6 +182,7 @@ function content_profile_registration_us
 function content_profile_registration_content_profile_settings() {
   return array(
     'registration_use' => FALSE,
+    'registration_filter' => FALSE,
     'registration_hide' => array(),
   );
 }
