I've been using content profile extensively in a timesheet application.

It works ok, but only because I've hacked my nodeapi to do so.

Here's the scenario. I create the a content_profile for the correct uid programmatically. I then go in and edit this profile from the admin account.

Two things happen that frustrate me:

1. The ownership of the profile reverts to admin (bad!)
2. The flag in the Drupal Content manager gets set to "new" when the node has just been updated.

I would love to have a cure for both these. The first has been fixed with a nodeapi hack, but it's not ideal. As for the second, I've traced node_save and checked that is_new is not set to true, but somehow the content manager always assumes it is whenever there's been an update.

Welcome your thoughts.

Comments

southweb’s picture

Any thoughts on this ...?

southweb’s picture

Still keen to get some feedback on this issue.

southweb’s picture

Here's a stripped down version of my code to address the issue. I'd love not to have to do this, and am happy to be told I've wasted my time here!

As you can see we force the profile name to be "Settings for <username>". Not very elegant, but what's the alternative?


/* Implementation of hook_nodeapi */

function mycust_nodeapi(&$node, $op,$arg1,$arg2) {
  global $user;
   
  switch ($op) {
    case 'load':
    case 'presave':
     if ($node->type == 'profile'){

      if (preg_match("/^Settings for (\w+)/",$node->title,&$matches)){
	    $owner =  _mycust_get_user($matches[1]); 
	    if (count($matches) >1 && in_array($matches[1],$owner)){
	        $uid = array_shift(array_keys($owner));
		$node->changed = ($uid != $node->uid) ? time() : $node->changed;    
		$node->uid = $uid;
	    }
      } else {
	    $node->uid = 0;
	    $node->name = "template";
      }

     if ($op == 'load' ){
         $node->defaults = unserialize($node->body);
         $node->content = array("#value" => theme("profile",$node));
       }

     }

     break;
     
     case 'update':
	 if ($node->type == 'profile')
	     content_profile_load("profile",$node->uid,'',true); // refresh the cache
	    
     break;
    default: return;
  }
}
southweb’s picture

Category: support » bug

I've upgraded this to a bug report as my support request has been ignored now for some months.

southweb’s picture

Component: Miscellaneous » Base module

Any update on this? Thanks

southweb’s picture

Since posting this we have made a few updates. In hook_user we check to ensure the name hasn't been changed and if it has, we update the user's respective node title. A separate table with node ids correlated to user ids would be far nicer, and I can't understand why more effort has not been made to ensure the integrity of the relationship between user and their content profile.

Another tweak in hook_user is that when (op == form) we check to ensure a profile exists, and create one if not.

Am a bit disappointed not to hear back from the original developers on this post!

guydaniels’s picture

Just to chime in. I'm having the same problem -- broken links to users after updating...