How to add user role choices when signing up for WordPress

In this article, I will show you how to add user role selection when registering in WordPress. By default the letter is about

registration of a new user contains information only about the name of the new user and his E-mail.

</ p>

Advertising

Advertising

This information may not be sufficient, e.g.For a wholesale online store running on WooCommerce, it was necessary to divide registered customers into wholesale and retail customers. The store administrator must know which customer has registered. He should receive an email with information about the type of new buyer, his email and name.
First, we need to create two new roles, for this we will install the WPFront User Role Editor plugin and create two roles through it.

1. Enter the name, any name that will be displayed on the front end during registration, for exampleWholesaler

Advertising

Advertising

2. Be sure to enter ONLYwith Latin lettersthe name of the role that will be sent to us in the letter, for exampleOPTOVIK

3. Copy the access rights of the new role from the roleCustomer(she can only read)

In the same way, create a role for the retail role.

Next, set the default role, for me it will be the role &#8220;Retail&#8220;.

That's all, the roles are created and you can start creating a new registration form.

So that the administrator can add a choiceuser roles when registering in WordPress, or so that it can divide users into wholesale and retail buyers, we will need a plugin for WordPress that replaces the standard registration form with its own more beautiful and highly customizable one. This plugin is called User Profiles Made Easy, it is paid and costs $28, if you feel sorry for money, you can search the Internet for a zero version.

After installing the plugin, go to settings &gt;UPME&#8211; Settingsfamiliarize yourself with all settings tabs. To add a selection of roles you need to go to the tabRegistration Optionsput a tick in the line thereSelect User Role at Registration.

In lineSelect Role Labelenter the text that will be next to the choice of role.

In lineChoose User Roles for RegistrationCheck the boxes for the roles that will be available for selection upon registration. In our case, we select the roleWholesale, and the roleRetailavailable by default, since we made it a standard role during registration.

Make the rest of the settings of this plugin your own.discretion. All we have to do is create a new registration page and insert the shortcode [upme_registration] into it. Other shortcodes can be viewed on the tabUPME System Pages.

Now, when registering, a new user can choose a role.

In the next article I will talk about how to customize the notifications coming to the e-mail admin and user.

</ p>