No announcement yet.

Want to restore deleted user

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Want to restore deleted user

    Hello -

    I deleted a user by mistake, who has many posts in the forum.

    I created a new user with the same username, then went to the vbuser table and changed the userid to match that user's previous id. Ran the post/user/fix profile options in admin/maintenance, and voila! Nothing

    The new user exists with the same ide as the old one. The threads and replies all have the same userid as the old.

    So why aren't the posts, replies and threads showing up as belonging to that user, when the userid matches up.

    What else must I do to reattach the user to her previous contributions?

  • #2
    You can't just change the userid in one table. You would have to change it in all tables that have that same id, including userfield and usertextfield.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography

    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    • #3
      Thanks! Since the new user hasn't done anything yet, this seems pretty simple. I just change the new id to the old userid in the userfield and usertextfield and the old posts will now point to the "new" user?


      • #4
        It's not that easy, sorry to say but it's best to just move forward
        -- Web Developer for hire
        ---Online Marketing Tools and Articles


        • #5

          If the posts all are linked to the userid, and the user has that user id, why not?

          This person has contributed much to my forum, and I don't want her to lose what she has put in over the years. Surely this has happened in the history of vbulletin, and some smart person figured out how to fix it.


          • #6
            So far, this seems a simple as it appears. Here's the path I'm on:
            1. Created new user with the original username, and backdated the join date.
            2. In the user table, I changed her userid from the new one to the original
            3. In the post table, I changed the userid from "0" to her original userid
            4. In the admincp > maintenance > Repair/Optimize Tables, I clicked the "Update Post Counts" button.

            So far, the posts I have edited are now attributed to her, and her post counts reflect the number of posts I have edited so far. She'll have to redo her signature, and other profile tweaks, but I seem to be getting what I am after.

            What am I missing here? Is there something that will cause problems elsewhere by using this approach?


            • #7
              The better plan would have been to update the userid in the post & thread tables from the old one to the new one, rather than messing with the userid in user type tables.
              Baby, I was born this way


              • #8
                I have to do this as well, I hope to get some support.

                I installed StopForumSpam (this is not a post about that service), and one of my moderators deleted the #1 user on my site with upwards of 10,000 posts by mistake. StopForumSpam is a good tool, but it's like a nuke in that just one mistake is incredible.

                So, were do I start? I have a database backup from the day before this happened.


                1) Did the threads/posts get removed from the db? How can I tell?
                2) If they are still in the db, can I just change the thread and/or post ID to the new userid?
                3) Anything else?
                Life is just a Big Skid


                • #9
                  The only supported option, is to restore the entire backup.


                  • #10
                    Originally posted by Paul M View Post
                    The better plan would have been to update the userid in the post & thread tables from the old one to the new one, rather than messing with the userid in user type tables.
                    I tried Paul M's suggestion. It worked partially. The old posts appear to be connected to the new user, but if you do search on that new user's posts, it doesn't return anything.

                    I updated thread.postuserid, thread.lastposterid, and post.userid.

                    Any other ideas?

                    I realize this is an un-supported action, but it sure would be helpful if we could come up for a solution for this common problem. It would make a very handy/popular popular hack if it can be done successfully!


                    • #11
                      If search isn't working, then I would guess you didn't update the searchcore or searchgroup tables (field is userid in both).

                      Please don't PM or VM me for support - I only help out in the threads.
                      vBulletin Manual & vBulletin 4.0 Code Documentation (API)
                      Want help modifying your vbulletin forum? Head on over to
                      If I post CSS and you don't know where it goes, throw it into the additional.css template.

                      W3Schools <- awesome site for html/css help


                      • #12
                        Bingo! updated searchcore. searchgroup didn't have any matching records.

                        This should be codified somehow, preferably by vbulletin or alternatively a pluggin from the community.
                        Or how about a vbulletin developed, unsupported hack posted in which explicitly declares the code as open source so it can be maintained and improved up by the community???

                        I would imagine it would be an option in admin->maintenance
                        Seems like all that is needed is the old userid or postid of one of the orphaned posts and the new username or userid.
                        The process should also put a note strongly recommending the database be backed up first.

                        Anywho... Thanks!!!


                        • #13
                          I created a new user with the same username of deleted user and run SQL command:

                          UPDATE post SET userid='xxx' WHERE username='Old Name';

                          But when i run "Find Latest posts by user" from his profile. it say: Sorry - no matches. Please try some different terms.

                          How i can solve it?



                          • #14
                            Please start your own thread in the support forum for your version, with full details of the problem.
                            MARK.B | vBULLETIN SUPPORT

                            TalkNewsUK - My vBulletin 5.6.4 Demo
                            AdminAmmo - My Cloud Demo


                            Related Topics