vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   !!!Deleted User on Accident!!! OMG!!! (https://vborg.vbsupport.ru/showthread.php?t=162353)

MorrisMcD 11-10-2007 09:19 AM

!!!Deleted User on Accident!!! OMG!!!
 
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)
UPDATE post set userid = NEW_USERID WHERE username = 'OLD_USERNAME';


SQL Query: (how to run queries)
UPDATE thread set postuserid = NEW_USERID WHERE postusername = 'OLD_USERNAME';

MorrisMcD 11-10-2007 09:37 AM

Quote:

Originally Posted by Marco van Herwaarden (Post 1379618)
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)
UPDATE post set userid = NEW_USERID WHERE username = 'OLD_USERNAME';


SQL Query: (how to run queries)
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

Quote:

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 [DATE]1194695646[/DATE] at [TIME]1194695646[/TIME] ---------------

Quote:

Originally Posted by Marco van Herwaarden (Post 1379627)
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 [DATE]1194695924[/DATE] at [TIME]1194695924[/TIME] ---------------

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 [DATE]1194696718[/DATE] at [TIME]1194696718[/TIME] ---------------

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

Quote:

Originally Posted by Marco van Herwaarden (Post 1379618)
SQL Query: (how to run queries)
UPDATE post set userid = NEW_USERID WHERE username = 'OLD_USERNAME';


SQL Query: (how to run queries)
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.


All times are GMT. The time now is 06:30 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01157 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete