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

Reorganise the User IDs of members

Discussion in 'XenForo Questions and Support' started by System0, May 18, 2012.

  1. System0

    System0 Active Member

    I tried out the xensso single login premium add on. It's a fantastic add on and the support was fantastic. Unfortunately, it doesn't currently work exactly as I would like. As such, I had to delete the 300+ members that were imported to my new forum.

    The downside to this is that the user ids of some users are too high, even though my new forum only has about 20 members or so (t the latest member has an id in the hundreds). I realise that the user id is used in a lot of tables so you can't simply change it. Also, auto increment means that new users will be set in the hundreds so all future members will be affected by this.

    Perhaps this is irrelevant but I'd like to correct it. What's the quickest way to resolve this?

    At the moment the user ids are:


    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    20
    21
    22
    23
    24
    26
    27
    28
    31
    361
    372

    Is it possible to change the database directly and reorganise the ids in order so that they go from 1 to 29?

    Would exporting the users and content and importing them back in resolve this?

    :)

    Kevin
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no easy way to fix this, but it's not a problem so I would ignore it.

    An import is required to compact the ids. One option is to import from XF to IPB and back to XF. There is no direct XF importer.
     
  3. System0

    System0 Active Member

    I don't have ipb but I could try phpbb or another free script. There would be the risk of losing some data though so perhaps it's not worth the risk.

    Is there no way to do it manually for the 4 or 5 accounts that are out of sync?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You would have to manually update all other tables that reference the user_id.
     
  5. System0

    System0 Active Member

    Do you know what tables they are?i assume I can just do an SQL query to replace all references of one particular user I'd with another.

    Would I have to change the auto increment value too? :)
     
  6. Naatan

    Naatan Well-Known Member

    In theory you could simply execute the following query (warning: backup your db first!)

    Code:
    ALTER TABLE xf_user AUTO_INCREMENT = xxx;
    Replace xxx with desired number (eg. if the highest member id is 10, make it 11).

    I say in theory as I don't know what type of record XF keeps of users after they have been deleted. It could potentially cause some problems, so make sure you backup first and do some testing after.

    But as Jake said; it really doesn't matter that it there is a space of unused user id's.
     
    System0 likes this.
  7. System0

    System0 Active Member

    Yeah that worked (I saw Jake post that in another thread). I updated the ids manually.

    I know it's kind of irrelevant anyways though the forum is new so it wasn't much work.

    Thanks for all your help yesterday with the add on :)
     
  8. Naatan

    Naatan Well-Known Member

    No problem, hope to see you back with 2.0 :)
     
    Jake Bunce and System0 like this.

Share This Page