Php – delete user best practice

mysqlphp

ive got a forum and i allow user to delete their account.

and i want the users threads to still be there and the username to be shown, but i wonder one thing.

if a user is deleted (basically i just NULL their username and password in the table row but i leave everything else intact) and another user is registering the same username, then people will believe that the new user with the same username has created all the threads the previous user created.

or is it routine to not allow new users to pick those usernames who have been deleted?

what is best practice regarding deleting users?

Best Solution

Add an extra column to your users table, called 'deleted' or similar. Default this to zero (false). When the user is "deleted", set this field to 1 (true). That way you won't run across any problems with users having duplicate usernames, as the original will be still present and linked to your existing posts etc.