In a scenario where admin has allowed users to register with no email verification, when the user registers and logs in, he is asked to accept the terms and conditions twice. Once in the registration form and second time after submitting the registration form. I think the bug is due to the following line of code within 'legal_user_insert' method.
// Don't insert if user is already registered (administrator).
if (!empty($user->uid)) {
return;
When i went through the $user object, i could see $user->uid set.
I think the possibility of no email verification during registration needs to be considered.
Comments
Comment #1
pbuyle commentedI guess the wanted behaviour is to not process legal acceptance for user created by an already (and different) user. So using a condition like
!empty($user->uid) && ($user->uid != $account->uid). That way the function exits if the current user is already registered and not the inserted user.The attached patch use this condition. It solved the issueon a site using a heavily customized registration process (merging a Profile2 creation, user registration and creation of a relation in a single multi-step form).
Comment #2
d0t15t commentedI have a similarly complicated login - this patch worked for me.
Comment #3
randallknutson commentedRan into this bug as well. The patch fixed it.
With two confirmations, changing to RTBC.
Comment #4
adam_b commentedWorked fine for me too.
Comment #5
marvil07 commentedIt seems like the module is never dealing with the checkbox on registration.
Here an alternative patch, it's not the best solution I guess, since it's using globals, but I cannot think in other way to get the values from registration form on the
hook_user_insert(), since at that point what we receive in$editparameter is not all form values, but a filtered list based on the account.Quoting
user_register_submit():Comment #7
marvil07 commentedComment #8
marvil07 commented5: handle-registration-accept.patch queued for re-testing.