We have two types of memeberships on our site that is invite-only. Is there a way to auto assign a role with the invite? Perhaps a different invite code? or a checkbox with the role selection before the invite?
Any ideas?
Thanks,
Andrey.
We have two types of memeberships on our site that is invite-only. Is there a way to auto assign a role with the invite? Perhaps a different invite code? or a checkbox with the role selection before the invite?
Any ideas?
Thanks,
Andrey.
Comments
Comment #1
mr.andrey commentedFound a way...
Auto Assign Role module gives the option to assign from a path, so if I can assign /user/register/role1 to auto assign role1 for user when they register.
Now there's just the invite module bit.
invite_accept() looks like this:
So if I can make it go to a different path based on a variable parameter, we'll be in business.
The easiest way to enter a bit of variable data is through the custom invite message. It's stored in the 'data' field of the 'invite' table and is accessible in invite_accept through $invite->data['message'].
So let's say that "-" will mean role1 and "--" role2. This will look fairly inconspicuous added to the bottom of the invite email.
in invite.module, invite_accept(), replace:
with:
That should do the trick. A bit jerry-rigged, but since it's essential for our invite-only setup to have different roles assigned at registration, it will have to do.
Best,
Andrey.
Comment #2
robin van emden commentedI cobbled together a quick solution along these lines as well. But it seems to me the "path to registration page" ought to be role-specific. For now I send the role id(s) along with the invite as extra vars & redirect according to this information. If I find the time, I might create a patch to enable this the right way (ie including admin setting etc).
Comment #3
avpadernoI am closing this issue, since it's for a Drupal version no longer supported.