function pmperson_migrate_email_adjust_form_save_validate in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 pmperson/includes/pmperson.migrate.inc \pmperson_migrate_email_adjust_form_save_validate()
- 7.2 pmperson/includes/pmperson.migrate.inc \pmperson_migrate_email_adjust_form_save_validate()
Validation function which is applicable for save operation only.
See also
pmperson_migrate_email_adjust_form()
1 string reference to 'pmperson_migrate_email_adjust_form_save_validate'
- pmperson_migrate_email_adjust_form in pmperson/
includes/ pmperson.migrate.inc - Form for resolving email conflicts.
File
- pmperson/
includes/ pmperson.migrate.inc, line 686 - Migration functions for the PM Person module.
Code
function pmperson_migrate_email_adjust_form_save_validate($form, $form_state) {
$id = $form_state['values']['id'];
$type = $form_state['values']['type'];
$mail = $form_state['values']['mail'];
switch ($type) {
case 'user':
if (valid_email_address($mail)) {
$account = user_load_by_mail($mail);
if ($account and $account->uid != $id) {
form_set_error('mail', t('User already exists with the given E-mail'));
}
}
else {
form_set_error('mail', t('E-mail address provided is not valid'));
}
break;
case 'pmperson':
if ($mail and !valid_email_address($mail)) {
form_set_error('mail', t('E-mail address provided is not valid'));
}
break;
}
}