You are here

function sharedemail_form_user_account_form_alter in Shared Email 7

Implements hook_form_FORM_ID_alter() for user_account_form().

Replace's the form's default #validate function with a wrapper function to make the User module think the e-mail address is unique.

See also

user_account_form()

user_account_form_validate()

2 calls to sharedemail_form_user_account_form_alter()
sharedemail_form_user_profile_form_alter in ./sharedemail.module
Implements hook_form_FORM_ID_alter() for user_profile_form().
sharedemail_form_user_register_form_alter in ./sharedemail.module
Implements hook_form_FORM_ID_alter() for user_register_form().

File

./sharedemail.module, line 103
Allow an e-mail address to be used by more than one user account.

Code

function sharedemail_form_user_account_form_alter(&$form, &$form_state, $form_id) {

  // Find the $form['#validate'] entry for user_profile_form's default validater,
  // and replace it with the name of this module's #validate function.
  if (is_array($form['#validate'])) {
    $key = array_search('user_account_form_validate', $form['#validate'], TRUE);
    if ($key !== FALSE) {
      $form['#validate'][$key] = 'sharedemail_account_form_validate';
    }
  }
}