I run a Drupal 7.10 / CentOS 6.2 website (where users can register after confirming their mail by clicking on a link) and there is a person registering at my site every night and then changing his name to obscene words.

First I've added a line to /etc/sysconfig/iptables to block his area:


but this has blocked other users from that area (Alma-Ata city).

The pattern of this user is:

  1. His IP address: strpos($_SERVER['REMOTE_ADDR'], '2.132.') === 0
  2. His mail (changing every time): preg_match('/[email protected]/i', $mail)
  3. His name (usually): stripos($name, 'st') !== FALSE

As you see - I have all the components there, I just need to know a good spot to put this code in. Anywhere to make his registration more difficult. An ideal case would be to sent admin a mail for registration verification, but just bailing out of the registration script (which one is it please?) would be okay too.

1 Answer 1


Drupal 6 had the possibility of avoid specific usernames, email addresses, matching an SQL pattern match could be used from users, and avoid those users matching those conditions could log in. There was also a setting for avoiding users could be log in from specific IPs, which is the only part kept in Drupal 7.

The other part has been moved to a third-party module I maintain. Being the maintainer, I can tell you that I didn't recently commit code for User restrictions, which at the moment is not usable because the code needs to be fixed. I count to start committing the code I have developed in the previous months starting from tomorrow, if there is not something else that take me busy. I actually need it in my website, which is running Drupal 7. I count to make the module as much generic as possible, and allow other modules to integrate with it through hooks; for example, the code I developed allows other modules to add rules that would be used to temporary block users.

For avoiding users would use specific usernames, there is also Ban List.

Banlist allows the administrator to disallow users from using a username from a list of usernames. The list consist of usernames such as: admin, administrator, root, demo, test, superuser, etc.

Although core can handle this, the primary purpose of the module is for people in the community to contribute to the list and make it very easy for everyone else to take advantage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.