删除用户最佳实践? [英] delete user best practice?

查看:28
本文介绍了删除用户最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个论坛,我允许用户删除他们的帐户.

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?

推荐答案

向用户表中添加一个额外的列,称为已删除"或类似的列.默认为零(假).当用户被删除"时,将此字段设置为 1 (true).这样您就不会遇到用户名重复的任何问题,因为原始用户名仍然存在并链接到您现有的帖子等.

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.

这篇关于删除用户最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆