I deleted user 1 while I was deleting spam users. Must have been some weird mix up. How can I recover quickly and re-assign all posts to this user?

Comments

andre75’s picture

well, i have restored the user, but i still need to change all posts that are now user 0 (anonymous) back to user 1.
does anyone have the sql code handy for this?

mdixoncm’s picture

If you want to change all content from user 0 to user 1 use something like this

update node set uid=1 where uid=0;
update node_revisions set uid=1 where uid=0;
update comments set uid=1 where uid=0;

That should get the most of the content - do you have any "different" modules running, poll, nodevote - anything where a user can create content other than a node or a comment?

Like books? Check out booktribes the new (Drupal based) community for book lovers
from Computerminds

andre75’s picture

I had figured it out yesterday night. I thought I posted here to report the progress and calm the seas but I guess I forgot.
I used this:
UPDATE `node` SET `node`.`uid` = 1 WHERE `node`.`uid` = 0
UPDATE `comments` SET `comments`.`pid` = 1 WHERE `comments`.`pid` = 0
UPDATE `comments` SET `comments`.`uid` = 1 WHERE `comments`.`uid` = 0
UPDATE `node_revisions` SET `node_revisions`.`uid` = 1 WHERE `node_revisions`.`uid` = 0

I do have nodevote running yes, what about it? I also have userpoints running, but on the admin account I don't care much.

Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com