You're building a new Drupal site that needs to handle two distinct types of users: Consumers and Service Providers. Each user group must have a unique role, profile type, and registration page. Users of each type should be able to visit your site, find the correct registration page, fill out their profile, and be granted an account with the correct role. Sounds easy, right?
Well, I recently found myself in this exact scenario. I was surprised to find that no combination of modules would exactly fit these requirements. This seemed like a great opportunity to build a legitimate, contributed module. Here it is: Profile2 Registration Path.
The purpose of this blog post is to tell a bit of that story, but more importantly, to show you how to do use it!
Jump to the Quick Step-by-step (TLDR)
Drupal 7 core provides us with an easy means of adding fields to the user entity. Unfortunately, using the core method requires that we make said fields available to all users. That's not very useful for our current requirements. Enter Profile2.
Designed to be the successor of the core profile module, Profile2 gives us a great starting point. Let's take a quick snippet from the Profile2 project description:
Awesome. Now we can create a Consumer profile type and a Service Provider profile type. We're all set, right? Not quite. We need to make sure that our users can easily fill out these profiles during registration, and that they are granted the correct user roles after signing up.
By default, the Profile 2 module permits you to add fields from each profile type to the default user registration form. Unfortunately, there is only one user registration form. Thus, during registration, every user will be presented with fields from all of the selected profiles. If you have two profile types targeted at two different audiences, you cannot have two separate registration forms. Bummer.
Profile2 Registration Path enables you to set a unique registration path for each Profile2 profile type. Users who register via that unique path will be presented with fields from the specified profile type(s), and may have corresponding roles assigned to them upon account creation. Yay.
Here's a quick list of features taken from the Profile2 Registration Path project page:
So now that we have all of the tools that we need, how do we put it all together?
That should do it! You now have a site that can truly support the organic growth of multiple, distinct user groups.
I initially tried to collaborate with the maintainers of the Auto Assign Role module, which was my go-to Drupal 6 solution for this scenario. I submitted a patch here that would introduce a hook, which would in turn permit the integration of other modules with AAR. Unfortunately, nothing came of it. I still think this is a good idea, so feel free to petition for it!
I'm working on adding more features to Profile2 Registration Path, including:
Of course, all feature requests and code contributions are welcome!
Happy coding.

Comments
Mark
Tue, 01/24/2012 - 01:04
Permalink
Great looking module and
Great looking module and great timing, need something like this for a project. Thanks!
Darwin Betancourt
Tue, 01/24/2012 - 13:12
Permalink
Great post
Great post I looking some like this.
Thanks a lot.
Brian Osborne
Tue, 01/24/2012 - 17:58
Permalink
Great
This is awesome, good work. This is a fairly common use case scenario that now has a great module for D7.
Azmat Shah
Tue, 02/14/2012 - 06:02
Permalink
Wonderful
I am going to create an ecommerce site where there will be clients and vendors...will it work with Drupal commerce too?
mark
Sun, 02/26/2012 - 22:20
Permalink
allowing the profile to registration path to be visible only
Is there are way for the path2registration path to be viewable upon normal login. I dont want to show this registration page to anonymous users, because I have a custom jobs module, where a I wish for the job applicant to first create username and email account with email verification, taking them to the path2registration page after auto login.
I hope this makes any sense!
madmatter23
Wed, 03/07/2012 - 20:54
Permalink
Use Rules to redirect after login
If I understand you correctly, you're asking if you can prompt the user to fill in profile fields after registration. If this is what you'd like to do, I'd suggest simply using the Rules module to redirect users to the 'edit profile' page after logging in for the first time.
Nico
Mon, 03/05/2012 - 13:09
Permalink
About to cry
i didnt try your cocktail yet, but im thrilled with it and hope it goes well.
Thanks
Josh
Fri, 03/09/2012 - 05:48
Permalink
Duplication of username, email and password
Hi, I am pretty new to all this and having some trouble with unique registrations I am trying to create.
Any unique profile registration I create has a duplicate of username, email and password fields. What I mean is that people who register on my site use the Drupal core registration process for general and pesonal details. Then they have the option of completing a seperate registration for a more specific profile type like childminder or nanny or babysitter. But they are once again faced with fields for inputting username, email and password. I am likely doing something wrong as opposed to this being a flaw. Any ideas?
nico
Mon, 03/12/2012 - 05:10
Permalink
list field
I did everything, but i created two equal text lists in both (client and provider) registration forms. Then I attempted to build a view that allows the client look for a concrete type of provider, but the data chosen by each user (client or provider) is not available in views.
In detail: each user must pick an instrument. The provider and the client both chose the same instrument (guitar) Later I want to let the client look for a user, of the type 'provider' and that chose 'guitar' on its registration. But the 'instrument' field is not available in views.
Anyone can point me in the right direction?
thanks
Bryan Hunter
Thu, 03/22/2012 - 04:17
Permalink
thanks
Just wanted to say thanks. I've spent all morning looking for an alternative to Auto Assign Role, having used D6 up until now. My searches came up with Profile2 a lot but not your module. I'm about to post a couple of replies to help others looking for something like this.
Hemant
Mon, 03/26/2012 - 10:55
Permalink
Thanks for your awesome contribution...
Thanks for your awesome contribution... I am still learning drupal and was getting very frustrated with the profile related questions I had... your blog breaks a month-long jinx for me... I am not a developer but will be very pleased to help you with anything that I could contribute. Thanks much.
Anonymous
Tue, 03/27/2012 - 22:43
Permalink
Great post , thanks a lot.
Great post , thanks a lot.
Hemant
Tue, 04/03/2012 - 22:17
Permalink
A question on another related use case....
On a conference website, we have diff roles, visitor, volunteer, keynote speaker, session speaker, minor sponsor, major sponsor, organizer and a hired worker... with each having access to diff content types on the website... what if a visitor registers as a visitor and then wants to become a sponsor (visitor->sponsor) or other scenarios such as (session speaker->keynote speaker) and then having to fill in the fields in the other role also... will the user have to repeat the entire registration process again... or could there be a method where only the additional fields are presented to register as another role in addition to the previous role... any help/ guidance is appreciated... thanks...
modreoci
Wed, 10/31/2012 - 00:25
Permalink
The same problem and a little bit more...
What if engagement of the registered users on my site graduates and it is necessary to fill out only some differentiall fields. There is still also need to apply multiple registration forms for already (in the moment of registration) differed user roles (depended on their actuall engagement) which will share some basic fields (for example First ad Last Name, Birthdate, personal ID, etc.) for all their site user lifetime as their angagement will graduate (or recede).
Many thanks for qualified reply... ;-) [email protected]
Alex
Tue, 04/10/2012 - 06:20
Permalink
Oh my!
Man, you saved me days of work.
I had implemented a (not so reliable) solution for Drupal6 with auto groups / auto roles using hooks and hiding/showing fields... but your solution is so smart, thank you ^^
Kartik
Sat, 04/14/2012 - 13:15
Permalink
Nice tutorial
Though Drupal 7 is full of useful and next generation features, still it is a little bit complex like the previous versions. The problem & solution about managing multiple users is really a headache. But as one gradually follow the steps mentioned here, it will be very easy for him to solve the same. password manager
Marx09
Mon, 04/16/2012 - 11:24
Permalink
user profile edit form
Hi, thanks for a great guideline. It was very helpful. My question is: Do you know how can I put profile (from Profile2) edit form to a user account edit form? There are two (or more) buttons and you have to edit it one by one... I wanna save all information together... Thanks for responding and one more for this article :-)
Marx09
Mon, 04/16/2012 - 11:25
Permalink
user profile edit form
Hi, thanks for a great guideline. It was very helpful. My question is: Do you know how can I put profile (from Profile2) edit form to a user account edit form? There are two (or more) buttons and you have to edit it one by one... I wanna save all information together... Thanks for responding and one more for this article :-)
SalmanX
Wed, 04/18/2012 - 08:11
Permalink
It seems too easy to creates
It seems too easy to creates the two user groups account by following the 11 steps as described by you in the above article. Never thought that it really will be that easy. So thanks a lot.
whosin
Anonymous
Sun, 04/22/2012 - 18:18
Permalink
I followed all the step by
I followed all the step by step and set it all up but it does not solve the issue, when I click create new account on the login page it takes me to the default user/register and all I see is the default registration page none of my field for each any of the profile type shows, how can I make the user choose a role and then get redirected to the correct registration form?
Josh
Thu, 04/26/2012 - 23:51
Permalink
Always find your stuff quite
Always find your stuff quite impressive, madman. Though lot of people face technical difficulty while doing something in Drupal. But believe, it is a great CMS. Certainly anyone will feel the initial awkwardness due to its vast application potential. But after through experience, you have to love it. Joshua Warren
dzinergal
Sat, 04/28/2012 - 02:56
Permalink
Profile2 File Type Fields Missing
HI
Thanks for a great Techi site!
I've followed your steps and are rearing to go but having difficulty setting up the fields for a profile under manage fields. I'd like to add a phone number field but the Number field type is missing on the Field Type dropdown. On a closer so is date, email and some other basic field types.
Have you come across this before? Your help much appreciated ;)
Thank you
madmatter23
Mon, 08/20/2012 - 13:46
Permalink
I don't think I've tested it
I don't think I've tested it with files fields, but I would expect all field types to work. Please file a bug in the issue queue (with more details) if you'd like this looked into.
Tasneem
Thu, 05/17/2012 - 19:21
Permalink
custom registration page
Hi
I followed all the steps here, and have my registration page at mysite/wpdocs/register, but this also shows the default registration form. Is there a way to not show that, and only my custom registration form?
Thanks
madmatter23
Mon, 08/20/2012 - 13:45
Permalink
hook_form_alter()
If you didn't show the default registration form, the user wouldn't be able to fill out the email, username, and password fields, which are required. It's possible to create a feature that would remove only the fields attached to the core user profile, but I would suggest just using hook_form_alter() to take care of this.
Max
Tue, 05/22/2012 - 10:12
Permalink
Multiple Roles for User
Would this module allow my already users to register for a new role? Say a student registering to be an assistant or something along those lines.
madmatter23
Mon, 08/20/2012 - 13:44
Permalink
Anonymous only
Sorry. Since this relies up on the user_register_form, it is only available to anonymous users.
gvanto
Thu, 05/24/2012 - 03:36
Permalink
Great Module & post, many thanks. Is there a way ...
... to create a specific login form (as a block, to display in sidebar) which will submit to the profile-specific login of this module?
madmatter23
Mon, 08/20/2012 - 13:43
Permalink
Working on this
This feature is in development on the 7.x-2.x. It's mostly working, but I've run out of time to complete the development. Please feel free to download it (via git) and help bring it the last few steps.
gvanto
Thu, 05/24/2012 - 17:39
Permalink
Is there a way to access "Edit User" form which also allows
to edit the fields from the profile?
when I click on the "Edit" tab (once profile-specific user has logged in), I only see the standard user edit fields, not the ones I specified for the profile ...?
For example I have specified (in Structure -> Profile Types) that there's a field "Facebook page" for profile "Vendor", but when I log in as that user, I can't see the edit feature for this field anywhere?
Any help much appreciated,
gvanto
Kora Sathish
Fri, 06/01/2012 - 06:30
Permalink
Great Module and awsome explaination
Excellent post and very helpfull to me .. Thanks folks
Krishna
Sat, 07/07/2012 - 02:32
Permalink
Display regisration form in block
I have created a new profile type.(mydomain.com/newprofiler/register). i want to display this regisrtaon form(along with newly added fields) in my custom block. i tired very hard. but no luck.
Any help!!
Tim
Thu, 07/12/2012 - 09:41
Permalink
great module
thx for the work, this is a great module. looking forward to the 7.2/x branch
Macmaci
Fri, 07/20/2012 - 17:31
Permalink
registration link
Thanks for this very useful info, however I dont see where I can display options for Member A and Member B to be presented with the different registration paths. The user login block only provides the default "Create User account" link which only links to one option. Am I overlooking something?
Thanks
madmatter23
Thu, 08/02/2012 - 10:40
Permalink
The current 7.x-1.x version
The current 7.x-1.x version creates only new registration paths (page callbacks) and does not modify the registration block. The 7.x-2.x version, which is not production ready, will modify the blocks as well.
LeeWyng
Thu, 08/02/2012 - 05:56
Permalink
RE:
The idea of your blog is extremely fresh, I'm sure that the visitors that read your blogs will definitely take pleasure from your content and pointers.
Rogerio
Thu, 08/16/2012 - 06:36
Permalink
Help a Drupal noob, please!
Hi Matt.
About step 7 of TLDR, "Enter a URL path to use for this profile type, e.g., 'consumer/register'":
Where the URL should point to?
A custom form registration?
If yes, the form should be created from scratch? Have you some suggestion for a tutorial to help me in this task?
Thanks!
madmatter23
Fri, 08/17/2012 - 14:57
Permalink
You should enter a URL that
You should enter a URL that is not being used by any other module. Profile2 Registration path will the automatically generate a registration form at that path, along with the attached profile2 fields.
Hosein
Fri, 08/31/2012 - 08:27
Permalink
how can i change default register path below login form block
hi
how can i change default register path below login form block to a node
so user can see a list of register types(like customer account,business account...)
and can click to register from page link and redirect to that register page
thanks
Anonymous
Wed, 09/12/2012 - 09:28
Permalink
Multiple User Per Profile
What would be cool is if you could have multiple users per profile... Which would easily create a group solution...
madmatter23
Thu, 09/13/2012 - 18:00
Permalink
That doesn't seem to fit with
That doesn't seem to fit with Profile2's intended purpose. If you'd like multiple users to share an entity, I'd suggest using Organic Groups, entity reference, node reference, or user reference.
Anonymous
Fri, 09/14/2012 - 10:56
Permalink
Newb Question: When using
Newb Question: When using this...
There is a simple drop down on the click selection that loads another field ... how do you do that?
madmatter23
Fri, 09/14/2012 - 11:03
Permalink
Two options
If you're interested in an out-of-the-box solution, I'd look at Conditional fields. However, that does not have a stable release yet.
The more directly, reliable, but more advanced way to do it would be to use hook_form_alter() to modify the form. Just add an appropriate #states attribute to the form element in question.
monsoon
Sat, 09/22/2012 - 16:47
Permalink
Profile 2 and default user sign up (Username and email field)
I am using this module but I am stuck with a problem of separating profile2 fields from default User sign up form. When I created this specific profile2 form I check the option "Show during user account registration." Which disappeared after that. This is a kind of bug not sure how to deal with this.
Since, I want a multipage/step sign up, that would also help if Default Drupal user account creation form can be added as a page/step 1. Which I again couldn't find a solution.
Please help, which suggestions.
Thanks,
madmatter23
Sun, 09/23/2012 - 18:56
Permalink
Please use the issue queue
If you have a support request for Profile2 Registration Path, or you would like to report a bug, please do so in the issue queue. I will respond to such requests there.
Joe
Mon, 09/24/2012 - 10:36
Permalink
Thanks!
Thanks for the detailed post; exactly what I was looking for!
Paul Booker
Wed, 09/26/2012 - 06:40
Permalink
If you want to send different
If you want to send different welcome email messages for different registrants what is currently the best way to implement this?
Best, Paul
madmatter23
Wed, 09/26/2012 - 07:10
Permalink
Rules
I would suggest using the rules module.
Paul Booker
Wed, 09/26/2012 - 07:40
Permalink
Thanks for the feedback O /
Thanks for the feedback O /
Aaron O.
Sun, 09/30/2012 - 22:21
Permalink
How to view profile page
I am new to drupal, and I just started tinkering with it today. I heard about profile2, and this module that compliments it is definitely what I was looking for, so great job!
My question now is, how can a "consumer" view their profile page, and update the fields. Let's say they have a bio, and the initial one isn't good enough that they would want to revise it, and update it? Or what if there is an address field that needs updating? Can this be done with profile2 and your module?
Thanks in advance!
madmatter23
Mon, 10/01/2012 - 15:51
Permalink
Yes, profiles can be edited
Yes, profiles can be edited by whomever is granted with the appropriate permissions.
Zeelpress
Mon, 10/01/2012 - 14:11
Permalink
Excellant
I was looking for solution for few days on a project, but accidently, I read this, and here's the one I was looking for.. thank u very much
Mark
Mon, 10/01/2012 - 22:53
Permalink
View profile page
I used Profile2path module, and login destination module to redirect users to the profile page. In addition I add a sub menu block on each profile using views ( filter by current log in user- profile = (role assigned), but this can also be done using rules either way.
John
Wed, 11/07/2012 - 11:30
Permalink
Issue
The new Profile Type has fields from the default profile type with no way to remove them.
Ramon Carvalho
Thu, 11/22/2012 - 10:48
Permalink
Path
I see only a problem in this module (maybe It's a problem only for me, I really don't know) when I install and configure Profile2 and Profile2 Registration Path I create two diferents path http://localhost/role1/register and http://localhost/role2/register but http://localhost/user/register still there and working.
It's a problem for me and I can't see a workround for this.
The best solution I think is to have the possibility to select the role in http://localhost/user/register e have personalized fields for role after the selection and before the registration.
Aaron Olin
Tue, 11/27/2012 - 20:54
Permalink
I just came across this.
I just came across this issue. All I did was add this to my .htaccess
Redirect /user/register /
the "/" just redirects to the homepage, you could do something like
Redirect /user/register /content/registration-options
Hope this helps!
Fawwad Ali Khan
Tue, 02/12/2013 - 11:11
Permalink
render form
how to separate label and text by drupal render.
Fawwad
Sun, 02/17/2013 - 04:02
Permalink
edit user profile
Hi this is great module but main problem with edit profile.How to edit user profile.
mahender
Tue, 04/02/2013 - 00:01
Permalink
Profile2 Registration Module
Great module great work, I just struck up with the proifle2 module itself, but this module did all my work. I just have one question, I have created 3 profiles (Teacher, student, parent). How to parent get the information about his child based on the admission number, I worked on views to do it , but i couldn't able to figure out it.
Thanks.
Al Hughes
Thu, 05/02/2013 - 10:14
Permalink
Maybe I missed something and
Maybe I missed something and I apologize if I did but when creating my path on the Profile Types settings page I put inthe word say "barber" in the open box, assuming this creates a the path "mysite/barber/register". However when I log out and go to this page I get a Page Not Found error.
Maybe its a step I missed or something I did not understand in the hep text..Any information would be appreciated. Thanks!
Anonymous
Tue, 05/07/2013 - 07:11
Permalink
is there a way to hide some
is there a way to hide some fields in the profile2 registration form ?
Ed
Thu, 05/09/2013 - 06:42
Permalink
hide fields
Use field permissions module. Hide the fields you want for anonymous users.
Add new comment