The module does not assign the selected role to a newly registered user upon registration IF login toboggan module exists and is configured to redirect to a specific page after signing up.

thanks

Comments

sym’s picture

Title: Conflicts with Login Toboggan » Role Signup conflicts with Login Toboggan
Project: Role Signup » LoginToboggan

Interesting.

Do you think this is a problem with role signup or Login Toboggan? I would have thought that Login Toboggan should process all the custom _submit hooks before redirecting.

I'd be intersted in some more feedback from them.

spooky69’s picture

Posting to subscribe - isn't there a simpler way to subscribe?

fidot’s picture

Title: Role Signup conflicts with Login Toboggan » subscribing

I get this conflict even when login toboggan isn't configured to redirect to a specific page after signing up.

fidot’s picture

Further investigation shows that it is the LoginToboggan option of "Use two e-mail fields on registration form" that causes the Role Signup module to not work. By not work, I mean that no entry is written to the users_roles table, meaning that the new user is not assigned any role at all.

I am using the Login Destination module to redirect, so it is not the redirecting within Login Toboggan that is causing the problem. I changed each of its other configuration options, one at a time, and narrowed the problem down to the "two e-mail fields on registration".

Hope this helps someone narrow the problem down.
Terry

sym’s picture

Title: subscribing » Role Signup conflicts with Login Toboggan

fixing title

fidot’s picture

I have traced the problem to line 211 in user.module

Changing if (is_array($array['roles'])) { to
if ($array['roles']) {

seems to do the trick.

However, I don't understand why this problem only manifests itself when the logintoboggan "two email option" is selected and I am not sure of any side effects of this change.

Should I report this in user.module too?

Terry

fidot’s picture

Please ignore my previous comment. The "real" issue is in line 255 of the logintoboggan module, as it assumes that any role set at this stage must be wrong, so an empty array needs to be passed to function user_save in the user module.

Replacing

  $roles = ($reg_pass_set && ($validating_id > 2)) ? array($validating_id => 1) : array(); 

with

  $roles = ($reg_pass_set && ($validating_id > 2)) ? array($validating_id => 1) : array($_SESSION['role'] => 1);

works for me. Given that $_SESSION['role'] is only defined by the rolesignup module (is that true?), the above change shouldn't have any side effects.

HTH
Terry

hunmonk’s picture

Status: Active » Needs work

we can't be hacking in special session vars for a single module. please provide a more general fix in unified diff format.

mwander’s picture

Is there an alternate solution?

Thank you.

Mitch

hunmonk’s picture

sure. check for existing roles in the page load, and merge in the logintoboggan changes instead of writing the roles fresh.

hunmonk’s picture

Title: Role Signup conflicts with Login Toboggan » Role Signup not properly submitting roles for form submissions.
Project: LoginToboggan » Role Signup
Status: Needs work » Active

fixed for 4.7: http://drupal.org/cvs?commit=75719
fixed for 5: http://drupal.org/cvs?commit=75717

see the commits for details on the fix. moving this issue to role signup module, as it really shouldn't be using SESSION vars to add roles on form submissions

ahoria’s picture

This is causing problems with me, even if I use the latest versions of rolesignup and logintoboggan.

Any clues?

Thanks a lot!

edex13’s picture

the dev version of logintoboggan is already patch (http://drupal.org/node/129411#comment-281608)
i still having problem with the role signup. below are the version of modules and date that i use.

logintoboggan 5.x-1.x-dev 2007-Oct-11
Role signup5.x-1.x-dev 2007-Jun-19

any update from developer?

yeeloon’s picture

i got the same problem as edex13.

running:
logintoboggan 5.x-1.x-dev 2007-Oct-11
Role signup5.x-1.x-dev 2007-Jun-19

any updates?

hunmonk’s picture

this module needs a complete rewrite:

  • it doesn't properly use fapi to handle the roles during form submission.
  • the registration process should not be a two step form, but integrated into the user registration form
  • the roles should be selected in an admin settings form -- the current approach is an incorrect use of the permissions system
panis’s picture

not sure there is a clean way to do that - because the current model integrates with the nodeprofile module.

The nodeprofile module has functionality to display the user profile node in the registration form itself.
But it is able to do so only if it knows coming into the registration form as to what role the user has.

Selecting the role within the registration form would mean having the profile information filled out in a second step - which may be functionality that some of us would like to avoid.

Any ideas?

panis’s picture

is this the problem???
logintoboggan has:

isset($form_values['roles']) ? array_filter($form_values['roles']) : array(); ....

while rolesignup has:

     $form['role'] = array(
        '#type' => 'value',
        '#value' => $_SESSION['role'],
        );

note 'role' vs 'roles'... and array versus a scalar

Which one should be fixed?

hunmonk’s picture

logintoboggan uses core's $user->roles array, and i will not change that. i think rolesignup needs to find a more standard way to track it's information.

cyberswat’s picture

Assigned: Unassigned » cyberswat

I agree with hunmonk ... This shouldn't be a problem to fix in the refactoring.

cyberswat’s picture

Status: Active » Fixed

The rolesignup module has been rewritten to use Drupal properly. The hacks that were in place to create this problem in the first place are no longer there. Please evaluate the dev snapshot of http://drupal.org/project/autoassignrole as I believe it fixes this.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.