Index: content_profile.module
===================================================================
--- content_profile.module	(revision 1356)
+++ content_profile.module	(working copy)
@@ -172,6 +172,17 @@
       'sub' => t("Show a secondary tab below the user's edit tab"),
     ),
   );
+  $form['display']['page_redirect'] = array(
+    '#type' => 'radios',
+    '#title' => t('Redirecting content profile node to the user page.'),
+    '#default_value' => content_profile_get_settings($type, 'page_redirect'),
+    '#description' => t('Optionally redirect all full page node views or default user profile views'),
+    '#options' => array(
+      0 => t('Do not redirect'),
+      1 => t('Redirect content profile node to user profile'),
+      2 => t('Redirect user profile to content profile node'),
+    ),
+  );
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Submit'),
@@ -400,6 +411,29 @@
     $node->uid = $node->translation_source->uid;
     $node->name = $node->translation_source->name;
   }
+  elseif ($op == 'view' && is_content_profile($node)) {
+    // Check that we are on node/N where N is the NID of a profile
+    if (arg(0) == 'node' && arg(1) == $node->nid && arg(2) == "") {
+      // Check if the redirect settings for this node type are set to redirect content profile to user page
+      if (content_profile_get_settings($node->type, 'page_redirect') == 1) {
+        // redirect to the user profile page
+        drupal_goto("user/". $node->uid);        
+      }
+    }
+    // Or check that we are on user/U where U is the UID of a user
+    elseif (arg(0) == 'user' && arg(1) != "" && arg(2) == "") {
+      foreach (content_profile_get_types('names') as $type => $type_name) {
+        // Check if the redirect settings for this node type are set to redirect content profile to user page
+        if (content_profile_get_settings($type, 'page_redirect') == 2) {
+          // redirect to the user profile page
+          if ($node = content_profile_load($type, arg(1))) {
+            drupal_goto("node/". $node->nid);
+          }
+        }
+      }  
+    }
+  }
+
 }
 
 /**
@@ -463,6 +497,7 @@
     'edit_link' => 0,
     'edit_tab' => 'sub',
     'add_link' => 1,
+    'page_redirect' => 0,
   );
 }
 
