[drupal-devel] [bug] deleted users' nodes disappear

nedjo drupal-devel at drupal.org
Sat Apr 9 17:20:23 UTC 2005

Issue status update for http://drupal.org/node/19055

 Project:      Drupal
 Version:      4.5.2
 Component:    node.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  menesis
 Updated by:   nedjo
 Status:       patch

There are several different actions that might be wanted in different
situations.  How about a followup page after user deletion providing
options, e.g., 
User [name] had [number] of posts and [number] of comments.  What do
you wish to do with this content?
[] Leave it in its current status.
[] Unpublish it.
[] Delete it.
Unless you delete the content, it should be assigned to a different
user.  What do you wish to do?
[] Assign it to the admin user.
[] Assign it to anonymous user.
[] Assign it to a different user ________.


Previous comments:

March 17, 2005 - 10:23 : menesis

Attachment: http://drupal.org/files/issues/node_user_delete.diff (507 bytes)

When a user is deleted, all nodes which he created can't be accessed
anymore, because they have non-existing uid and queries which select
from node and user tables fail.
There are two ways to fix that:
1) also delete nodes.
2) reset nodes' author to Anonymous.
1 is most probably undesirable side effect. When I encountered such
problem I was happy those nodes were still in database and I could
bring them back by changing uid. Otherwise I would have lost the
Here is a simple patch which implements 2) - sets node.uid to 0


March 17, 2005 - 10:34 : chx

At this state I strongly -1 the patch. I'd like to see a message about
what happened (maybe a number of nodes changed would be nice, too) but
this is a minor thing -- mayor is that I feel unpublishing such nodes
is a must. Let the admin decide whether it fits her purposes to let
other uses see them as Anonymous posts or do something else.


March 17, 2005 - 10:39 : moshe weitzman

when we first implemented deletion of users, we discussed a lot and
decided to not delete the whole uid row; we removed the email address
and set the users.status = 0. I must have missed the patch which
implemented the full deletion from the database. I think full deletion
is too dangerous because all nodes and comments will disappear, as
you've noted. So my suggestion is to soften the deletion which is found
in user_edit() as it used to be.


April 9, 2005 - 08:20 : Carl McDade

How hard would it be to change delete the user but change any content
using that users id to first user ownership? This would prevent the
house of cards effect.


April 9, 2005 - 13:04 : Steven

We'd need to make every module which stores anything user-related to
respond on the user delete event, and then change ownership. It sounds
like a large hassle, and I agree with moshe that resetting the e-mail
adress and blocking the account is much easier and safer.

More information about the drupal-devel mailing list