| 1 |
<?php |
<?php |
| 2 |
// $Id: mailalias.module,v 1.9 2004/10/01 21:51:48 ankur Exp $ |
// $Id: mailalias.module,v 1.10 2005-11-29 18:37:30 webchick Exp $ |
| 3 |
|
|
| 4 |
function mailalias_user($type, &$edit, &$user, $category = NULL) { |
function mailalias_user($type, &$edit, &$user, $category = NULL) { |
| 5 |
if ($type == 'form' && $category == 'account') { |
if ($type == 'form' && $category == 'account') { |
| 6 |
// when user tries to edit his own data $output = |
// when user tries to edit his own data $output = |
| 7 |
$output = form_textfield(t('Email aliases'), 'mailalias', $user->mailalias, 70, 255, t('Add any additional email addresses, separated by commas. We use these to identify the author of email submissions. These email addresses are private and are not shared with other users.')); |
$form['account']['mailalias'] = array( |
| 8 |
return array(array('title' => t('Personal information'), 'data' => $output, 'weight' => 2)); |
'#type' => 'textfield', |
| 9 |
|
'#title' => t('Email aliases'), |
| 10 |
|
'#default_value' => $user->mailalias, |
| 11 |
|
'#weight' => 1, |
| 12 |
|
'#description' => t('Add any additional email addresses, separated by commas. We use these to identify the author of email submissions. These email addresses are private and are not shared with other users.'), |
| 13 |
|
); |
| 14 |
|
return $form; |
| 15 |
} |
} |
| 16 |
else if ($type == 'validate' && $category == 'account') { |
else if ($type == 'validate' && $category == 'account') { |
| 17 |
$mailalias = strtr($edit["mailalias"], array (" " => "")); // strip spaces |
$mailalias = strtr($edit["mailalias"], array (" " => "")); // strip spaces |
| 18 |
$mailsarr = explode(",", $mailalias); |
$mailsarr = explode(",", $mailalias); |
| 19 |
foreach ($mailsarr as $mail) { |
foreach ($mailsarr as $mail) { |
| 20 |
if ($mail != null && $error = user_validate_mail($mail)) { |
if ($mail != null && $error = user_validate_mail($mail)) { |
| 21 |
form_set_error(t('Mail Alias'), $error); |
form_set_error('mailalias', $error); |
| 22 |
} |
} |
| 23 |
} |
} |
| 24 |
return $edit; |
return $edit; |