[wp-hackers] deleting a user, save posts by him

Nikolay Bachiyski nbachiyski at developer.bg
Wed Apr 6 21:43:07 GMT 2005


Amit Gupta wrote:
>  
> deleting a user at the moment also deletes all his posts. can it be 
> worked around? I mean, can the posts be prevented from deletion while 
> the user is deleted?
> 
First move all the posts to another user and then safely delete him/her 
from userlist. Moving could be tough if both there are many posts of 
this user and you do not to interact directly with the database ;)

So here are two ways of moving posts from user to user.

Numbr one.Go to Manage->Posts and for each post of this user change the 
owner to the user of your preference. No, I do not know how to do this 
with the 500 post of the user :)

The second way of moving - in a mysql console execute:
UPDATE <db prefix>_posts SET post_author=<id of the move-to user> WHERE 
post_author=<id of the to-be-deleted user>.

You can get user ids from the Users section in the administration.

Nikolay


More information about the wp-hackers mailing list