Note: This content is more than one year old. It may not contain the most up to date information.
Out of the box, Restrict Content Pro requires members to enter a username when registering. This makes sense because RCP uses the built-in WordPress user database, and the username is a requirement. However, we often see people wanting to use the email address as the username, and they want to know how to remove the username field from the registration form. This is pretty easy to do with just a few lines of code. Let’s take a look.
Removing the username field
First, we need to remove the username field from the form. To do that, copy the registration template into your child theme folder, and remove the username field. The RCP documentation covers this step here.
However, removing the field from the form doesn’t remove the code that makes the field a requirement, and it doesn’t make the username the email address. To do that, continue on.
Removing the username field requirement and using the email address
When someone submits the registration form, RCP checks that the username field is completed. If it’s missing or empty, the registration will not successfully complete. To remove this requirement, and to use the email address instead, you need this small code snippet.
If you’re not familiar with how to add a code snippet to your site, you can install Pluginception, use it to create a new custom plugin, paste in the code, and activate your new plugin.
That’s all there is to it! With these few simple steps, you can remove the username field from your registration form and use the email address for the username instead.