View Full Version : !!!Deleted User on Accident!!! OMG!!!
MorrisMcD
11-10-2007, 09:19 AM
Oh wow... I really messed up
I accidentally deleted a user from a drop down box when thinking I was about to edit. Curse all the confirm boxes we must click in our IT lives.. Makes them almost pointless because I am so prone to just click it... Ugh!!!
Well anyway.. I deleted one of my mods.. All his posts are still there as him but appear as a guest.. (no links on username, etc)
So damn.. Please tell me I can import his user, posts, etc back into my site with a restore.. Only problem there is I havent backed up in several weeks. I dont want to lose several weeks just for a single user restore...
PLEASE PLEASE PLEASE!!! Someone tell me I am not screwed!!!
Marco van Herwaarden
11-10-2007, 09:32 AM
You are screwed. :D
You can not restore just 1 user.
The best you can do is:
- Create a new user for him and setup as usual. Make a note of the new userid.
- Run the following queries to bring back the threads and posts to his new acount (create backup before doing so!!!!!), replacing the correct username and userid (this assumes you will reregister him with the same name):
SQL Query: (how to run queries (http://www.vbulletin.com/docs/html/maintenance_query))
UPDATE post set userid = NEW_USERID WHERE username = 'OLD_USERNAME';
SQL Query: (how to run queries (http://www.vbulletin.com/docs/html/maintenance_query))
UPDATE thread set postuserid = NEW_USERID WHERE postusername = 'OLD_USERNAME';
MorrisMcD
11-10-2007, 09:37 AM
You are screwed. :D
You can not restore just 1 user.
The best you can do is:
- Create a new user for him and setup as usual. Make a note of the new userid.
- Run the following queries to bring back the threads and posts to his new acount (create backup before doing so!!!!!), replacing the correct username and userid (this assumes you will reregister him with the same name):
SQL Query: (how to run queries (http://www.vbulletin.com/docs/html/maintenance_query))
UPDATE post set userid = NEW_USERID WHERE username = 'OLD_USERNAME';
SQL Query: (how to run queries (http://www.vbulletin.com/docs/html/maintenance_query))
UPDATE thread set postuserid = NEW_USERID WHERE postusername = 'OLD_USERNAME';
lol Yea I thought I was screwed.. To a certain point anyway...
This is what I did and I THINK I may be pretty good considering my boneheaded move..
I recreated a user with the same username.. Went into the database and changed his new user to have the old ID.. Thankfully I had a page open with a link of his name so I didnt have to figure it out. Once I did that, some of the hacks I have linked right back up his profile.. Ribbons, Gifts... Stuff like that... I have never pruned or manually set post count so I am rebuilding that now.. I guess I could have just manually put in his posts since I knew what it was (again from that page I had open).. I am thinking I might be good on most counts.. Any thoughts?
Marco van Herwaarden
11-10-2007, 09:51 AM
Went into the database and changed his new user to have the old ID..
Bad move, userid is used on more (previously deleted) places. Best is to follow the instructions i gave.
MorrisMcD
11-10-2007, 09:53 AM
Looks like the threads actually deleted the uid that posted it... Still looks 'guestish'..
I don't allow guests to post on my site.. So maybe I could actually run a query to change every threadid that doesn't have a username to change to his?? If I have to plug in his posts the next time I may have to do a post rebuild, I guess I can live with that too.. But if anyone has any ideas, I am all ears :)
--------------- Added 1194695646 at 1194695646 ---------------
Bad move, userid is used on more (previously deleted) places. Best is to follow the instructions i gave.
Ok cool.. I will do that then if you say so.. Thanks for the advice.. I can reverse what I did so far
--------------- Added 1194695924 at 1194695924 ---------------
Actually.. Sorry to be chatty, but couldnt I actually still use your queries with my current situation and just treat his old uid as NEW_USERID since I manually changed it?
--------------- Added 1194696718 at 1194696718 ---------------
You are the man!!! I did a backup.. I was confident in your queries....
UPDATE post set userid = NEW_USERID WHERE username = 'OLD_USERNAME';
I did just make the newuserid his old one. This query fixed everything.. I looked at the thread set.. It actually keeps the userid in the threadsets.. So I didnt have to run that one..
Thank you so much for your help!!! All seems good now
karabaja3
01-12-2008, 10:55 AM
SQL Query: (how to run queries (http://www.vbulletin.com/docs/html/maintenance_query))
UPDATE post set userid = NEW_USERID WHERE username = 'OLD_USERNAME';
SQL Query: (how to run queries (http://www.vbulletin.com/docs/html/maintenance_query))
UPDATE thread set postuserid = NEW_USERID WHERE postusername = 'OLD_USERNAME';
OMG. Thank You so much! It worked! THX a 100
klaush
01-12-2008, 02:33 PM
Thanks, Marco! I hope i´ll never come into a situation tu use your solution, but i think you should migrate this into the vb manual as well!
Marco van Herwaarden
01-14-2008, 07:25 AM
doubt this will ever make it to he manual. We do not advertise running manual queries. Also using the information in an older thread could be dangerous. Things might have changed between versions or the solution might not apply to the new problem.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.