Index: content_profile.module
===================================================================
--- content_profile.module	(revision 37754)
+++ content_profile.module	(working copy)
@@ -281,7 +281,12 @@
     // Set the author value - note that this works only for admins.
     if (!empty($_GET['uid']) && ($uid = intval($_GET['uid'])) && ($user = user_load($uid))) {
       $form['author']['name']['#default_value'] = $user->name;
+      $form['uid']['#value'] = $user->uid;
     }
+    elseif (is_numeric(arg(3)) && ($uid = intval(arg(3))) && ($user = user_load($uid))) {
+      $form['author']['name']['#default_value'] = $user->name;
+      $form['uid']['#value'] = $user->uid;
+    }
   }
 }
 
@@ -376,6 +381,13 @@
  */
 function content_profile_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
 
+  // UID not set correctly if correct user doesn't have right permissions for
+  // user tabs
+  if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && isset($node->name)) {
+    if ($account = user_load(array('name' => $node->name))) {
+      $node->uid = $account->uid;
+    }
+  }
   if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && $node->uid && !user_access('administer nodes') && arg(0) != 'admin') {
     // Check if this nodetype already exists
     if ($nid = content_profile_profile_exists($node, $node->uid)) {
