MyBB Community Forums

Full Version: SQL command to associate all posts by a previously deleted user with a new account?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay, so during a routine bot sweep, I accidentally deleted two normal members. I'm wondering if there's an SQL command I can run, given a UID associated with a new account with the same name as the deleted "guest user", to restore posts to the new accounts.
I would assume it would look at the posts username and then change the uid if it matches the name of the deleted user.
If you have regular backups made, you should be able to pull that table and reinsert those deleted users.
UPDATE mybb_posts SET `uid` = 'X' WHERE `username` = 'Y'
UPDATE mybb_threads SET `uid` = 'X' WHERE `username` = 'Y'
Replace mybb_ with your table prefix, X with the new users' uid and Y with the old users' username.