How do I automatically assign a role based on which Membership type is chosen?

Comments

rconstantine’s picture

Status: Active » Postponed

I'm pretty sure I didn't add that as a feature. Changing this to postponed (feature request).

rconstantine’s picture

Category: support » feature
Priority: Critical » Normal
Chris Gillis’s picture

Sorry, I guess I just don't get it. The user goes through the "Select Desired Membership" screen, straight into the user register screen like normal. They don't get assigned a different role depending on their choice, or led into a pageroute after login. What does the "Select Desired Membership" screen actually do? Am I just missing the point of this module?
Apologies, Chris

Chris Gillis’s picture

Component: User interface » Code
Status: Postponed » Active
StatusFileSize
new1.02 KB

Whipped up a quick module to assign roles based on membership type.

Excuse the format, I don't yet know how do fancy stuff like CVS and patches, or whatever. Let me know what you think of the code.

Also I realise now that it only works with "Require e-mail verification". If this is not checked, the user gets logged in straight away and never sees the pageroute.

rconstantine’s picture

The module's purpose is to allow several DIFFERENT pageroutes, one for each membership type. This assumes that the admin wants to collect different information from each membership type - which I do. What you may have thought this module to be is my account types module - sort of. The accounttypes module restricts the roles that a given user can have but currently does not assign default roles per account type. That is a feature request there as well, so I'll probably add it to both modules with a check to make sure they work well together as they do now.

I'll take a look at your code soon.

rconstantine’s picture

Status: Active » Fixed

Refactored your code an included it in my module. Made provisions so that it doesn't step on the toes of the new auto-role-assign of accounttypes module.

Whereas the additions to this module allow for one role to be auto-assigned, the accounttypes module allows as many roles per accounttype/membership type as you wish. So check it out if you want more than one role automatically assigned.

Anonymous’s picture

Status: Fixed » Closed (fixed)