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

XF 1.1 Insert a past user into the database

Discussion in 'XenForo Questions and Support' started by trilogy33, Feb 6, 2012.

  1. trilogy33

    trilogy33 Well-Known Member

    Is it possible to insert a userid, by means of the database (xf_user) back in the table?

    Example of a past user table:

    User id - username

    1 admin
    2 mod
    3 user1
    4 user2
    5 user3_deleted
    6 user4
    7 user5

    ^ In this scenario, userid 5 was deleted back in the past.
    So, can, without any ill effects, a new user be inserted, so long as all the necessary fields including a proper formatted UNIX timestamp for join date, last activity, etc. (where required) be physically inserted into the database to complete the table thus?:

    User id - username

    1 admin
    2 mod
    3 user1
    4 user2
    5 added_new_username_goes_here
    6 user4
    7 user5
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Directly editing the database is never a good idea as there are lots of tables involved.

    Ideally you would use the datawriter for this and force the ID to 5 rather than use the next one available.
     
    trilogy33 likes this.
  3. ragtek

    ragtek Guest

    that's not possible because the id is autoincrement;)
    You'll need to change the table structur, remove the autoincrement, set the id yourself, turn autoincrement on again (via phpmyadmin or mysql in the console...... )

    BUT as brogan said, there are other tables with an reference to the user_id and you never know if all data are deleted if a user have been deleted;)
     
    trilogy33 likes this.
  4. trilogy33

    trilogy33 Well-Known Member

    Thanks guys. I knew there was more to it than meets the eye.
    Best to leave well alone. (y)
     

Share This Page