If a user needs to create an account on a Drupal site, they go to the user registration page at “/user/register”. This page is the registration form on a Drupal site. You can customize it by adding or removing fields. But what if you want to have multiple registration pages?
Let’s say you have two different roles on your Drupal site and you need a separate form for each role. How would you build that?
You could handle all of this writing custom code but remember we’re using Drupal so means there’s a module that can handle this type of functionality and It’s called Multiple Registration.
The Multiple Registration module allows you to create individual registration forms base off a user role in Drupal. When you register on one of the forms, you’re automatically assigned the configured role.
In this tutorial, you’ll learn how to use Multiple Registration to create individual registration forms.
Installing the module
Download and enable the module with your preferred method.
composer require drupal/multiple_registration
drush dl multiple_registration -y
After downloading the module, click Extend in the toolbar and install it.
Create User Roles
The Multiple Registration module requires additional roles in order to display a customized registration form to each role. For the purpose of this tutorial, we’ll work with the example of a high school site with a registration form for parents and another for students.
The form for parents will have a field requiring information about payment methods and a billing address, while the form for students won’t have those fields, but instead of that will have a select list to vote for a sports team.
Click People, Roles, “Add role” in order to create the “Parent” role.
Repeat the process and create a “Student” role. After you’ve created the roles click the dropdown arrow next to the Parent role and choose “Add own registration page”.
You’ll be prompted to create a path for the Registration page for this particular role. For example, you could add “user/parent” as the path.
Create also a registration page for the other role (in this case “Student”).
Configure Registration Forms
Now that you’ve created the roles, it’s time to configure the registration form for each one.
1. Click Configuration, “Account Settings”, “Manage fields” and click the “Add field” button.
2. Choose the “List(text)” option and label it “Payment method”.
Enter in a few options into “Allowed values list” and set the “Allowed number of values” to Unlimited, since a parent can have more than one payment method and click “Save field settings”.
1|Cash 2|Credit Card 3|Check 4|Other
You’ll be redirected to the Edit tab, scroll down to the bottom of the page and check “Users with Parent role”. This configuration is provided by the Multiple Registration module. Click “Save settings”.
Add another text field for the Billing address and assign it to the Parent role.
Lastly, add a list field for a sports team election, this one will be limited to one choice. In the Edit screen of this field check “Users with Student role” and click “Save settings”.
Test New Registration Forms
Click “Log out” on the right of your screen and click “Log in” on the same spot once again. You will see two new tabs corresponding to the roles we’ve previously created.
If you can’t see the tabs then you’ll need to rebuild the site cache. Go to Configuration, Performance and click “Clear all caches”.
Check each form and make sure the fields were assigned properly to each form.
The Multiple Registration module provides the ability to create different registration forms without having to write code. Best of all, the role configured in the form is automatically assign when a user registers. This will save you time because you want have to manually assign a role.
16 thoughts on “Create Individual Registration Forms using Multiple Registration in Drupal 8”
You can also “hijack” or “override” the page at /user/register by creating a page and setting it’s page to /user/register. You can then create a page with icons that link to the various registration paths. This also has the benefit of disabling the original registration link that creates a generic account.
Thanks Myke. That’s an elegant solution. Good tip!
The form_mode_manager module can also do this, but it works much more generic.
Thanks for the tip.
Hi I love your videos on YouTube,
I use multiple registration module but, when I log out and try to create new account it says can not send the email if the problem persists contact admin,
Can you help me to figure it out what’s going on
That means that your server can’t send an email which is beyond the scope of this tutorial.
You can start debugging it by googling “drupal 8 can’t send email”
Thanks for this short yet brilliant tutorial.
One question : how about “Multiple Registration Welcome Emails”?
What’s the lighter and best solution to send custom email messages per registration type? Use Rules module maybe?
Great question, did a bit of digging and found this: https://www.drupal.org/project/multiple_registration/issues/2790139
Does not work with Rules. Mind you, Rules for Drupal 8 is still in alpha.
Well, that’s annoying.
As I am quite a newbie in Drupal, what do you advise me to do to have specific welcome e-mails sent per role ?
– Keep on using Multiple Registration, assuming the Rules issue mentionned above will be solved soon (in Beta)?
– Consider another solution?
Thanks for your help.
you can configure the webform module to send a particular email with some basic logic handling each time a condition is met in the registration form. You wouldn’t use the Multiple Registration module in that case and therefore you should assign roles manually.
Thanks for the advice. I will try this as well as other workarounds and see.
You’re welcome. Good luck!
Can this be configured to produce the login and register blocks on the same page? I found docs on how to do it in Drupal 7, but not 8. Thanks!
Not sure, but give it a go.
How is this different from the profile 8 module?
The Profile module allows users to have different profiles, which are fieldable entities.
This module just focuses on creating registration forms for different roles and that’s it.