When I pass a parameter on the URL for example user/register?anything=anything it does not recognize the $form_id.
The user name field still shows up.

Comments

salientknight’s picture

with test code I ruled out $form_id as the cause, but the module still fails to work if I pass arguments on the URL.
user/register works but even user/register? keeps the code from working.

salientknight’s picture

Status: Active » Closed (fixed)

I found the problem:
Changing the code:

if (isset($form['account']) && is_array($form['account'])) {
        $form['account']['name']['#type'] = 'hidden';
        $form['account']['name']['#value'] = user_password();
        $form['account']['mail']['#title'] = t('E-mail');
      }
      else {
        $form['name']['#type'] = 'hidden';
        $form['name']['#value'] = user_password();
        $form['mail']['#title'] = t('E-mail');
      }

to

  $form['name']['#type'] = 'hidden';
  $form['name']['#value'] = user_password();
  $form['mail']['#title'] = t('E-mail');

Made the problem go away for me. I guess Putting an argument on the URL causes this line to return true: if (isset($form['account']) && is_array($form['account'])) but the user-register.tpl.php uses $form['name'] not $form['account']['name']
I hope this helps someone else....