Nick
Nick

Reputation: 859

Handling spam user profiles without deletion

I run a site which allows users to create profiles, which naturally attracts SEO spammers trying to push their own links. I'm developing a one-click admin system to banish these profiles (but keep the details recoverable in case of error) - which approach below would be considered 'best practice' (if any)?

1) Create a copy of the users model (e.g. banned_users) and move banned users across to this model so that their accounts are disabled

2) Add a banned_user flag to the user profile and add a callback to every user action which checks whether the field returns true

My instinct says that 1 is cleaner - is there a better way of doing this?

Upvotes: 0

Views: 53

Answers (1)

Donovan
Donovan

Reputation: 15917

Personally, given your described requirements, I would use option 2 (toggle a 'banned' flag to true). It seems cleaner to me because:

  • It's easier to un-do if a user is mistakenly banned
  • Doesn't require multiple reads/writes from your database.
  • You can run queries on all users (banned or not) without joining multiple tables.

Upvotes: 2

Related Questions