1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 sql command change user id

Discussion in 'Troubleshooting and Problems' started by Adam Howard, Feb 8, 2014.

  1. Adam Howard

    Adam Howard Well-Known Member

    OK. So basically X user was deleted and restored. But not 100% completely.

    Old user ID is 10096
    New User ID is 10485

    Looking for a quick SQL command that will search all tables and replace those values correctly to associate it with the correct account.
     
  2. Adam Howard

    Adam Howard Well-Known Member

    PHP:
    SELECTDISTINCT
    TABLE_NAME
    FROM
    INFORMATION_SCHEMA
    .COLUMNS WHERE COLUMN_NAME ='user_id'
    I know this command will tell me all the tables where user_id column is. But I would rather not have to do a search and replace on each table individually.

    Sort of looking for a search all tables for column X, see if value is Y, and if so change to Z.
     
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    You can't. I believe there is an addon.
     
    SneakyDave likes this.
  4. Adam Howard

    Adam Howard Well-Known Member

    I was fairly sure there was away to do it. I guess I'll have to do it table by table.

    The add-on you're thinking about only changed post contents (I believe).

    Thanks for the help just the same :)
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    SneakyDave likes this.
  6. Adam Howard

    Adam Howard Well-Known Member

    Thanks, but not what I was looking for (see post #1)

    User was deleted, then using another add-on was restored, but generated a new user id number in the process. Post are oddly associations, but other aspects were not.

    Orphan user id is still in database and goal is to replace orphan with current ;)
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no feature to merge users. It would have to be done manually with SQL queries for each and every user_id field. It will be tedious.

    I do not recommend this.
     
    SneakyDave likes this.
  8. Adam Howard

    Adam Howard Well-Known Member

    Already done. :D Took a while... o_O. But done. ;)

    The user was deleted.
    I then restored the user (there is an add-on for un-deleting deleted members)

    Turns out it didn't restore everything and does so by making technically a new user id (same name as before though). It then tries to associate the two, but it didn't do such a hot job.

    So I did it all manually.... Took a while, but done.
     

Share This Page