Here's a patch that allows to:
1. define all roles that can be assigned to invited users
2. for each role with 'send invitations' define a subset of roles from #1 this particular role can assign
3. selection of target role based on #2 on the invite page/in invite block
4. selected role in #3 is now available in hook_invite('invite')
4. adds a new hook hook_invite_redirect() that allows to redirect users in invite_accept() to a custom page

Todo:
1. allow each role to assign multiple roles (replacement for previous default role + additional role per role setting)

Comments

nonsie’s picture

Better patch

YK85’s picture

Hello,

I have a question regarding your patch and hoping it will help my situation.

When a user with Role A invites a friend, I want that friend to receive Role A.
When a user with Role B invites a friend, I want that friend to receive Role B.

Or an invite link for:
Invite a friend to join Role A
Invite a friend to join Role B

Thanks!

Archnemysis’s picture

subscribe

hefox’s picture

This is also possible in a submodule, but needed to change the submit callback. I'm wondering if it may be better to put it in a submodule, as doesn't seem like a common use case, and adding a presave to invite_save (you can use hook_invite escale to add roles :)).

Patch has some non-related stuff in it, that invite_redirect stuff.