Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 11-10-2007, 09:19 AM
MorrisMcD's Avatar
MorrisMcD MorrisMcD is offline
 
Join Date: Nov 2003
Location: Cincinnati, Ohio
Posts: 415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default !!!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!!!
Reply With Quote
  #2  
Old 11-10-2007, 09:32 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are screwed.

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';
Reply With Quote
  #3  
Old 11-10-2007, 09:37 AM
MorrisMcD's Avatar
MorrisMcD MorrisMcD is offline
 
Join Date: Nov 2003
Location: Cincinnati, Ohio
Posts: 415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
You are screwed.

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?
Reply With Quote
  #4  
Old 11-10-2007, 09:51 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 11-10-2007, 09:53 AM
MorrisMcD's Avatar
MorrisMcD MorrisMcD is offline
 
Join Date: Nov 2003
Location: Cincinnati, Ohio
Posts: 415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 View Post
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
Reply With Quote
  #6  
Old 01-12-2008, 10:55 AM
karabaja3's Avatar
karabaja3 karabaja3 is offline
 
Join Date: Jan 2008
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
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
Reply With Quote
  #7  
Old 01-12-2008, 02:33 PM
klaush klaush is offline
 
Join Date: Oct 2005
Posts: 340
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #8  
Old 01-14-2008, 07:25 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:16 PM.


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.03999 seconds
  • Memory Usage 2,232KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete