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

pbuyle’s picture

I 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).

d0t15t’s picture

I have a similarly complicated login - this patch worked for me.

randallknutson’s picture

Status: Active » Reviewed & tested by the community

Ran into this bug as well. The patch fixed it.

With two confirmations, changing to RTBC.

adam_b’s picture

Worked fine for me too.

marvil07’s picture

Issue summary: View changes
StatusFileSize
new1.75 KB

It 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 $edit parameter is not all form values, but a filtered list based on the account.
Quoting user_register_submit():

  // Populate $edit with the properties of $account, which have been edited on
  // this form by taking over all values, which appear in the form values too.
  $edit = array_intersect_key((array) $account, $form_state['values']);
  $account = user_save($account, $edit);

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: handle-registration-accept.patch, failed testing.

marvil07’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Status: Needs work » Needs review
marvil07’s picture