• 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

trilogy33

Well-known member
#1
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
 

Brogan

XenForo moderator
Staff member
#2
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.
 
R

ragtek

Guest
#3
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;)