Goal
Drupal core should provide different user registration pages for different roles. The main target is to automatically assign at least one custom user role to a registered user. With that role assigned, modules relying on user roles are able to display different views or site functions to each user.
Customizations
- Separate registration paths for each user role, i.e.
/user/register/rolexy. - A role identifier for
/user/register/identifier, since roles might have inappropriate role names, f.e. 'Cool members'. - A setting for default user role, if
/user/registeris illegitimately used. - Optionally different 'registration complete' pages definable per user role, f.e. to forward new members to their user profile and advertisement partners to their ad settings page.
Example use case:
- Almost any community / portal site which has regular members and special premium members. Maybe there are even special premium members or advertisement partners.
- Regular members will see common cummunity/portal features.
- Premium members may have additionally profile fields, features or any other possibilities.
- Advertisement partners may only be able to adjust their ads or maybe their paid services.
Implementing this feature should allow user profile modules to display and require different user profile fields in registration form for each role. F.e., advertisement partners have to register with their full business address. Ecommerce module may be integrated into registration process for premium members.
This feature requires barely customizations to the user module but provides a whole new facility for Drupal-driven web-applications.
Co-trigger of this issue: http://drupal.org/node/61932#comment-118133
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | rolesignup_0.module | 4.33 KB | sym |
| #6 | rolesignup.module | 4.72 KB | sym |
| #1 | profile_8.module | 41.31 KB | havran |
Comments
Comment #1
havran commentedI have quick hack for profile.module (which i use in my site), which give me this functionality (sort of). I have two new role for user - kníhkupec and spolupracovník (bookseller and contributor in english) and some constants for this role.
PROFILE_TYP_POUZIVATEL => 1 // simple authenticated user
PROFILE_TYP_SPOLUPRACOVNIK => 2 // contributor
PROFILE_TYP_KNIHKUPEC => 3 // bookseller
For table {profile_fields} i must define new column profile_type, which use this constants.
With this hacked module i can define different fields for each role.
Comment #2
sym commentedI have some code that I am using on a site of mine. It's a module, so it doesn't need any core hacks at all, but it needs a load of work to make it flexable and secure enough.
If someone wants to have a look then I'll post the code, or I will try to update it and make it better myself.
Comment #3
sym commentedPs, at the moment my module works on the rid, not the role name, and I have just set up a path for it.
As for profiles, I am looking at using the new CCK profiles rather than the core profiles.
Comment #4
sun@sym: Let's have a look on the work you've already done. Maybe it will be a good starting point. It might also be a good practice to start off with a contrib module extending/replacing core features, which will be committed to core after successful testing. But first of all we need a initiation.
@havran, sym: Regarding profiles, we have to concentrate on separating user registration forms to allow different user roles first. There are more than one possible modules people might use for user profiles, so this is definitely a second step and another issue following this one.
Comment #5
sym commentedRE profiles: You're right, getting the registration sorted is key, with profiles following.
I will clean up my code today and post it later on. Here is what I have:
Roles with an option to allow new users to register for them - normal user creation, with the addition of the selected role, so they become an "authenticated user" as well as the selected role based on the URL.
This can't be done with form_alter on the role admin page because of some problems with the form in user.module. I've gone though this with chx on #drupal and the only way to fix it is to do a major rewrite of the user module. I'm not going to do this in a hurry, so I have opted for a different admin page!
user/register - lists all the roles that can be signed up for and link to the correct page.
More later.
Comment #6
sym commentedOk, after a bit of a clean up here it is.
I have had to grab the code from user.module to show the register form - maybe not the best way to do it. Other than that, it just used the standard access control and the rest is quite simple.
Thoughts?
Comment #7
venkat-rk commentedYou might want to change version to CVS as new features will never be added to stable 4.7.2 as per drupal policy.
You might also like to look at the previous discussions on this topic:
1.) Moshe suggests the following as a solution: http://drupal.org/node/42663#comment-80165
2.) Project Opus have done an implementation of this for their site. Please see comments from this one onwards: http://drupal.org/node/31656#comment-82284
Hope this helps.
Comment #8
sym commentedThis a module that doesn't touch the core, so there is no problem with it being 4.7.2 as I can just update the module to 4.8 in September.
The module uses hook_user as one of the links you posted said.
Comment #9
venkat-rk commentedThanks. Is this a patch to user.module or a separate module?
What I meant by cvs was that even if this patch is accepted, it won't make it to the tarball of 4.7.2 as it is a new feature, so CVS may be better.
Comment #10
sym commentedno, it's not a patch, it's just a contrib module that can be added to any 4.7 install. Or at least thats what I hope it will be - it's not finished yet and I wouldn't advise anyone use it on a live site until it's been reviewed.
It doesn't need any tables, so just put it in /modules and enable it in admin/modules.
Comment #11
venkat-rk commentedGreat, thanks. I have always wanted this so I will be sure to try this out.
Comment #12
sym commentedAnd feedback is welcome - more on the code side than anything else for the moment. :-)
Comment #13
fagogood idea - but why not create a project for this module? :)
@the code (I only looked quickly)
cache your menu items -> only return them if $may_cache is true
Comment #14
sun@fago: Depends on the impact of this feature on user module.
@sym: Good start. I did not have the time to have a deeper look on your rolesignup module but I hope that we are able to realize this feature without duplicating/altering so much code of the user module.
As proposed, I'm changing version to CVS.
Comment #15
sym commentedMy module is for 4.7 and it's not been tested on CVS, so it shouldn't be marked as CVS.
Changing back to 4.7
I am duplicating the user module code at the moment, but I might be able to change that. I will not do anything that needs a patch on the user module.
Comment #16
sunImportant feature extension: Other modules, such as Ecommerce module, either have to be able to redirect new customers to a specific registration form to register for the "customer" user role within the checkout process, or they have to be able to alter the registration form with a hook. Latter one sounds better to me.
We also need a new access right to "allow registration for this role" per user role. And we have to consider, if there are different registration processes needed, f.e. user activation by an admin for advertisiment partners but no user activation for regular site members.
I still believe this issue can be solved by a patch to the user module and the whole functionality should be provided by core, so let us have a look on extending user module first, please.
Ramdak is right, since this is a feature request for the Drupal user system and not rolesignup.module, the version of this issue has to be CVS.
Comment #17
marcoBauli commented*bumping and subscribing for news
Comment #18
marcoBauli commentedinstalled rolesignup.module on 4.7.2 but no luck:
when browsing to /admin/settings/rolesignup i get a Page not found error.
Did anybody tried this module later than 4.7, or went further somehow in the development?
Comment #19
sym commentedHi,
I made rolesignup for a 4.7.2 site, but it's now working on 4.7.3. I'm not sure why you're getting the page not found, but I don't think you'll need to use it - I think I changed the settings to hook_perm so you should be able to go to your access control page.
Note that this isn't a project at the moment. I have CVS access but I'm about to move house so I can't do anything on it. I hope to get it sorted out and turned in to a project in the next month or so (and I'll work out how to get it working on 4.8/5.0 as well...but thats down the line a bit after the freeze).
If you do want help, contact me though my contact form, as this thread isn't the right place for support of my module ;)
Comment #20
kweisblatt commentedI put this on my 4.7 site, but when going to the admin-settings-rolesignup, I get a "page not found" error. When I log out to try and create a new account, I see the "Please select what type of account you want" but then nothing else. So, users woudn;t even be able to sign up at all. Great module and I hope it works soon!
Comment #21
sym commentedHere is the updated module - I really should make a project for it soon!
Comment #22
kweisblatt commentedHmmm... I just downloaded another module that seems to be working fine http://drupal.org/node/72057#comment-159725
I'm not sure what the differences are :)
Comment #23
ngstigator commentedThe main difference that I've noticed is that when using user_role_register, an administrator can add a user into a particular role, whereas as far as I can tell, that feature in rolesignup is broken.
Comment #24
coreb commentedMoving out of the "x.y.z" queue to a real queue.
Since a module of the same name as a project came out of this, I'm putting this into that module's queue.
Comment #25
sym commentedI guess that makes it fixed then.
Comment #26
(not verified) commented