I deleted a few users from our university research project website. Their contents is still in the database, but the "delete user" interface provided no warning on the fact the nodes wouldn't be visible anymore (shows n/a error page).

I'm talking of DOZENS OF HOURS of valuable work that is no longer accessible, so I feel a bit stupid not to have just blocked users. I know there's a vivid debate about how user deletion should be handled generally, but it doesn't help me solve my problem in the short term.

There are too many nodes that need to be fixed, so I am actually looking for a quick SQL fix that would reset all nodes' UID to 1.

This should work fine (I think). But I am no SQL expert. What should I do?

Comments

nevets’s picture

You have the uid deleted (we will call it deleted_uid) and the replacement (replacement_uid)
The (psuedo) sql is
UPDATE node SET uid = replacement_uid WHERE uid = deleted_uid

You will need to replace the words replacement_uid and deleted_uid with the actual numeric value of the uid.

sillygwailo’s picture

"the "delete user" interface provided no warning on the fact the nodes wouldn't be visible anymore"

Really? It says "Deleting a user will remove all their submissions as well. This action cannot be undone." when I just tried it in 4.6.

(Username formerly my full name, Richard Eriksson.)

ideaoforder’s picture

I realize this is months after this question, but I've made a simple module called node_adoption that allows you to select an existing user as the adopted parent of orphan nodes. So anytime a user gets deleted, those nodes are automatically acquired by the specified user. I'd be happy to post the module somewhere if there's any interest.

pwolanin’s picture

yes, please post- here's a possible place, if you don't want to maintain it in CVS: http://drupal.org/node/70903

---
Work: BioRAFT

Adriana Alarcon’s picture

One of my users was deleted and it has caused my whole site to go wonky. There is an "access denied" message on all our pages unless you are signed in. I think the user who was deleted had enabled the user settigns. please help