Drupal assuming admin created user, when user registered normally This is something that I'm pretty sure worked when in beta, but doesn't work now anymore. 

I have setup the user registration to be allowed by visitors, but a confirmation by the admin is required. Email verification isn't required. I have composed all the necessary emails.

Now, when a user registers, two things go wrong:


no mail is sent to the admin
the wrong mail is sent to the new user


The new user receives a mail stating that the admin created his account and that he can use the one-time login link to change his password. When he clicks on this link, he doesn't have access to the page, because the account isn't active yet. 

The user should receive the mail telling him he registered succesfully and his registration is waiting for approval. The admin should receive the mail that a new user was created.

Sometime, the admin will create the users, so both mechanisms will be used. But I get the impression Drupal thinks it was always the admin that created the user, even if it was a normal user registration.

I have a rule setup (from the Rules module) for when a new user registers, to add him to certain roles. But this worked in beta, now it doesn't anymore. Also, disabling this rule, or disabling the rules module entirely didn't help.

Any ideas where I can start looking?
As it turns out, a custom-made module conflicted with the normal behavior in a sneaky way. 

In D7, when you create a user as an admin, the checkbox to send an email with a one-time login link is not selected by default. As the person creating users is not a technical person, I thought it might be user friendly if this was checked by default.

After a bit of searching, I found a small module that could help. What this piece of code did was:

if ($form_id == 'user_register_form') {
    $form['account']['notify']['#default_value'] = TRUE;
}


However, as you can see there is no check if the current user is the admin. So Drupal assumes the admin is creating the user, even for a normal registration by a visitor. Subsequently, the visitor gets a mail that the admin created his/her account.

I explained this for the author also, and hope someone fixes it (or I'll try myself when I find the time).