2

I have a site where there are 2 independent user roles, USER_TYPE_1 and USER_TYPE_2. Profile2 RegPath module gives me the two unique registration pages for unique role assignments. With LoginToboggan, all new users get a 3rd type of role, NON_AUTHENTICATED, which is removed after verification.

I'm looking for users to get limited permissions (non-authenticated role) before verification, then more permissions (USER_TYPE_2 or USER_TYPE_2 depending on which registration form they used) after verification.

1

LoginToboggan invokes hook_user_update() when it validates an email. It sets the property $account->logintoboggan_email_validated to TRUE so you can test it upon your own hook invocation. Inside your hook_user_update invocation, you can use the profile2 function profile2_load_by_user($user) to load the validated user object profile to determine which additional roles need to be set.

  • Seems the right direction, but is there no caveat? Did someone actually try this? Afaik the profile2-specific role needs to be present during the registration itself, then removed for the verification phase, and then re-added when verification is complete. But what happens if a user edits his/her account while not yet verified? will this damage the profile2, because the role is missing? or will the profile2 simply not show up in the form, because the role is missing (which could be confusing)? – donquixote Jun 10 '16 at 1:16
  • Maybe it is safer to give up on this password-on-registration option. – donquixote Jun 10 '16 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.