Role Signup not properly submitting roles for form submissions.

adnanshareef - March 20, 2007 - 10:38
Project:Role Signup
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:cyberswat
Status:closed
Description

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

#1

sym - April 25, 2007 - 19:34
Title:Conflicts with Login Toboggan» Role Signup conflicts with Login Toboggan
Project:Role Signup» LoginToboggan
Version:5.x-1.x-dev» 5.x-1.x-dev

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.

#2

spooky69 - April 27, 2007 - 07:55

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

#3

fidot - June 18, 2007 - 18:00
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.

#4

fidot - June 18, 2007 - 20:22

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

#5

sym - June 18, 2007 - 22:25
Title:subscribing» Role Signup conflicts with Login Toboggan

fixing title

#6

fidot - June 18, 2007 - 23:18

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

#7

fidot - June 19, 2007 - 07:15

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

#8

hunmonk - July 12, 2007 - 00:44
Status:active» patch (code 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.

#9

mwander - July 30, 2007 - 18:47

Is there an alternate solution?

Thank you.

Mitch

#10

hunmonk - July 30, 2007 - 20:03

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

#11

hunmonk - July 30, 2007 - 22:26
Title:Role Signup conflicts with Login Toboggan» Role Signup not properly submitting roles for form submissions.
Project:LoginToboggan» Role Signup
Version:5.x-1.x-dev» 5.x-1.x-dev
Status:patch (code 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

#12

ahoria - September 12, 2007 - 13:40

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

Any clues?

Thanks a lot!

#13

edex13 - October 24, 2007 - 11:51

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?

#14

yeeloon - November 4, 2007 - 15:50

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?

#15

hunmonk - November 4, 2007 - 20:09

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

#16

panis - December 4, 2007 - 22:20

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?

#17

panis - December 6, 2007 - 14:50

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?

#18

hunmonk - December 6, 2007 - 23:39

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.

#19

cyberswat - January 30, 2008 - 14:52
Assigned to:Anonymous» cyberswat

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

#20

cyberswat - February 1, 2008 - 23:03
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.

#21

Anonymous (not verified) - February 15, 2008 - 23:11
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.