WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Scott Reilly v3.7

Restrict Usernames

Restrict the usernames that new users may use when registering for your site.

Restrict Usernames

The facts

Rating
3.6★ from 14
Active installs
200+
Price
Free
Last updated
21 Jun 2018
Added
Jul 2009
Requires WP
4.7
Tested up to
WP 4.9.31
Downloads
24,657

Our analysis

AI-assisted

Restrict Usernames is a WordPress plugin that allows you to limit the usernames that new users can select when registering for your site. It is designed for sites with open registration, enabling you to prevent the use of undesirable or reserved usernames, as well as enforce specific formatting rules. The plugin is particularly useful for site administrators who want to maintain control over the usernames used on their platform.

The plugin provides various options for restrictions, such as blocking offensive words, preventing username squatting, and enforcing character limits. It also allows for custom validation through a filter hook, enabling further customization of username checks. However, it does not restrict usernames chosen by administrators when creating accounts from the WordPress admin area.

Best for: This plugin suits WordPress site administrators who want to control user registration by limiting username choices.

What it does well

  • Allows restriction of undesirable usernames
  • Compatible with Multisite and BuddyPress
  • Custom validation through a filter hook

Where it falls short

  • Limited compatibility with some membership plugins
  • Does not restrict admin-created usernames

Verdict

Restrict Usernames offers useful functionality for managing user registrations, but its limitations with certain membership plugins may affect its usability for some users.

From the developer

Scott Reilly's own description of Restrict Usernames, lightly tidied.

This plugin allows you to restrict the usernames that new users may use when registering for your site.

If open registration is enabled for your site (via Settings -> General -> Membership (“Anyone can register”)), WordPress allows visitors to register for an account on your blog. By default, any username they choose is allowed so long as it isn’t an already existing account and it doesn’t include invalid (i.e. non-alphanumeric) characters.

Possible reasons for wanting to restrict certain usernames:

  • Prevent usernames that contain foul, offensive, or otherwise undesired words
  • Prevent squatting on usernames that you may want to use in the future (but don’t want to actually create the account for just yet) (essentially placing a hold on the username)
  • Prevent official-sounding usernames from being used (i.e. help, support, pr, info, sales)
  • Prevent official username syntax from being used (i.e. if all of your administrators use a prefix to identify themselves, you don’t want a visitor to use that prefix)
  • Prevent spaces from being used in a username (which WordPress allows by default)
  • Require that a username starts with, ends with, or contain one of a set of substrings (i.e. “support_”, “admin_”)
  • Require a minimum number of characters for usernames
  • Limit usernames to a maximum number of characters

When attempting to register with a restricted username, the visitor will be given an error notice that says:
ERROR: This username is invalid. Please enter a valid username.

NOTE: This plugin does not put any restrictions on usernames that the admin chooses for users when creating user accounts from within the WordPress admin. This only restricts the names that users choose themselves when registering for your site.

SPECIAL NOTE: Many membership plugins implement their own user registration handling that often bypasses checks (and hooks) performed by WordPress. As such, it is unlikely that the plugin is compatible with them without special plugin-specific amendments.

Compatible with Multisite and BuddyPress as well.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Hooks

The plugin exposes one filter for hooking. Typically, customizations utilizing this hook would be put into your active theme’s functions.php file, or used by another plugin.

c2c_restrict_usernames-validate (filter)

The ‘c2c_restrict_usernames-validate’ hook allows you to add your own customized checks for the username being registered. You can add additional restrictions or override the assessment performed by the plugin.

Arguments:

  • $valid (boolean): The assessment by the plugin about the validity of the username based on settings. True means username can be used.
  • $username (string): The username being registered.
  • $settings (array): The plugin’s settings.

Example:

Read the full description on the official page →

Tagged as