Updating an existing node changes its ownership to the updater in Drupal 6, and not in Drupal 7.

This is the observed behaviour, but perhaps it is not the intended behaviour.

I've written a few applications in Drupal where the node ownership was critical, and must never be changed once set. In D6 this has caused us quite a lot of grief. In D7, the naive test I just performed indicates it is not an issue - that the creator retains ownership.

What is the theory and practice around this - and has it changed from D6 to D7? How can I be confident of maintaining the node creator's relationship to the node?

Some time ago I posted this, but am still to get a satisfactory reply.

http://drupal.org/node/1197310

Thank you.

Comments

southweb’s picture

Is there anyone taking responsibility for issues associated with the node module?

southweb’s picture

Come on guys - is no one concerned about this issue?

justageek’s picture

I am working on 2 fairly large Drupal 7 sites, I have never seen this behavior. I have not see node ownership change to user 2 when user 2 edits a node authored by user 1. I looked through the core node code, and I don't see this modification in the core logic. So, I don't think this is normal behavior.

Also, the link you provide in your original post points to an issue with content_profile, so I'm not sure why you suspect the core node logic.

southweb’s picture

Hi Justageek

Thanks for your reply. I haven't seen the issue happen on Drupal 7 either which is a good thing, but it certainly happened on Drupal 6! That was my issue. Can we be confident this has been fixed. I'm guessing yes, but was a bit a surprised by the lack of interest in the issue. It certainly made a larger scale Drupal 6 development we were working on a real nightmare.

ayesh’s picture

I didn't notice in D6 either.
Do you have revisioning enabled ?

southweb’s picture

I wasn't using revisioning, but didn't disable it per se. Is it not enabled by default?

Yes, we lost many hours on this project, and did make many posts about the topic but failed to get any answers. Whenever a user with "edit any" permissions edited an existing node the ownership changed to the new editor!

justageek’s picture

I'm working on the Symantec Connect project, an extremely large D6 project, with 300,000+ registered users. We have never had an issue.

did you find code that you believe is a problem?

southweb’s picture

It was in node_save. A typical example was with the profile module. If an administrator edited a user's profile, the profile became the administrators!

I'm not ruling out it could have been our set up. But it certainly caused a lot of grief.

justageek’s picture

So, it must have been somewhere in custom code.

southweb’s picture

This is probably the offending code: node.module:851

if (user_access('administer nodes')) {
// Populate the "authored by" field.
if ($account = user_load(array('name' => $node->name))) {
$node->uid = $account->uid;
}
else {
$node->uid = 0;
}
}

justageek’s picture

When you edit a node the 'name' form field is pre-filled with the author's name. The only way this ownership is changed is if the user manually selects another username in this form field using the auto-complete field provided. So, this code is fine. IF you did your own form alter code and modified this field or the group to which it belongs, then things could go wrong for sure. Otherwise, this code works as expected and has worked throughout the life of D6.

southweb’s picture

Yes, I appreciate that. But then we did have issues so I'm guessing the issue is with the oldd Drupal 6 Profile module - which has now been supplanted by Profile2 so I probably won't pursue this further.

Wish we'd had this chat a few years ago! Thanks for your input.