Hi, thanks for a great module!

Form field validation callback function email_registration_user_login_validate():

  1. Defines $form, &$form_state as parameters instead of $element, &$form_state, $form, see https://api.drupal.org/api/drupal/developer%21topics%21forms_api_referen....
  2. Sets $form_state['values']['email'] instead of the commonly used $form_state['values']['mail']

No big deals, but still worth mentioning.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lmeurs’s picture

Status: Active » Needs review
FileSize
869 bytes

Attached patch.

lmeurs’s picture

FileSize
1.6 KB

Rerolled the patch for 7.x-1.3.

greggles’s picture

Title: Typos? » Incorrect arguments in form validate function?
Priority: Minor » Normal

Interesting typos, for sure. Since the email_registration_user_login_validate function doesn't use the $element nor $form arguments it seems that never caused a bug/confusion, but now they should be changed to match the spec.

Regarding 'mail' vs. 'email' I think it might be a feature that this is in 'email' as it is different than core on purpose. Is there a case where this caused some kind of bug or does it just make sense to you?

andypost’s picture

D8 affected the same

  1. +++ b/email_registration.module
    @@ -191,7 +191,7 @@ function email_registration_form_user_admin_settings_submit($form, &$form_state)
    -function email_registration_user_login_validate($form, &$form_state) {
    +function email_registration_user_login_validate($element, &$form_state, $form) {
    

    ++ on this change

  2. +++ b/email_registration.module
    @@ -203,7 +203,10 @@ function email_registration_user_login_validate($form, &$form_state) {
    +    $form_state['values']['mail'] = $form_state['values']['name'];
    

    also not sure about this change because it maybe incompatible with some other contrib

andypost’s picture

Priority: Normal » Major

Not sure how that works now but email_registration_user_login_validate() is element validator

greggles’s picture

Status: Needs review » Needs work

Marking as needs work to remove the change about email vs. mail.

@andypost why do you mark this as major? What's the impact of it?

andypost’s picture

@greggles I marked major because I can't get how it wotks now because form vs element valudators very different set of arguments

greggles’s picture

Status: Needs work » Needs review
FileSize
685 bytes

OK, here's a reroll of just the function signature without the email/mail change. That should go into a new issue/patch for discussion.

greggles’s picture

Fixing my credit.