By default, the Restrict Content Pro registration form has two separate fields:
- Username
This tutorial will show you how to remove the username field and allow registration with email only. Members will be able to login with their email address directly instead of remembering a separate username.
Remove The Username Form Field
Add this custom CSS snippet to Appearance > Customize > Additional CSS to hide the username field:
#rcp_user_login_wrap { display: none; }
Set The Email As The Username
Just removing the field isn't enough, because RCP is expecting a username to be entered and will throw an error if it's not filled out. To combat this, we need to remove the "Username is empty" error message and assign the email as the username. To do that, add this code to your child theme's functions.php file or to a custom plugin:
<?php /** * This will remove the username requirement on the registration form * and use the email address as the username. */ function jp_rcp_user_registration_data( $user ) { rcp_errors()->remove( 'username_empty' ); $user['login'] = $user['email']; return $user; } add_filter( 'rcp_user_registration_data', 'jp_rcp_user_registration_data' );