| 1 |
<?php |
<?php |
| 2 |
// $Id: mailalias.module,v 1.9 2004/10/01 21:51:48 ankur Exp $ |
// $Id: mailalias.module,v 1.12 2007/12/16 15:01:22 weitzman Exp $ |
| 3 |
|
|
| 4 |
function mailalias_user($type, &$edit, &$user, $category = NULL) { |
/** |
| 5 |
if ($type == 'form' && $category == 'account') { |
* Implementation of hook_user(). |
| 6 |
// 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.')); |
function mailalias_user($type, &$edit, &$user, $category = NULL) { |
| 8 |
return array(array('title' => t('Personal information'), 'data' => $output, 'weight' => 2)); |
if ($type == 'form' && $category == 'account') { |
| 9 |
} |
// when user tries to edit his own data $output = |
| 10 |
else if ($type == 'validate' && $category == 'account') { |
$form['account']['mailalias'] = array( |
| 11 |
$mailalias = strtr($edit["mailalias"], array (" " => "")); // strip spaces |
'#type' => 'textfield', |
| 12 |
$mailsarr = explode(",", $mailalias); |
'#title' => t('Email aliases'), |
| 13 |
foreach ($mailsarr as $mail) { |
'#default_value' => $user->mailalias, |
| 14 |
if ($mail != null && $error = user_validate_mail($mail)) { |
'#weight' => 1, |
| 15 |
form_set_error(t('Mail Alias'), $error); |
'#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.'), |
| 16 |
} |
); |
| 17 |
} |
return $form; |
| 18 |
return $edit; |
} |
| 19 |
} |
else if ($type == 'validate' && $category == 'account') { |
| 20 |
} |
$mailalias = strtr($edit["mailalias"], array(" " => "")); // strip spaces |
| 21 |
|
$mailsarr = explode(",", $mailalias); |
| 22 |
function mailalias_help($section) { |
foreach ($mailsarr as $mail) { |
| 23 |
if ($section == "admin/modules#description") { |
if ($mail != NULL && $error = user_validate_mail($mail)) { |
| 24 |
return t("A user may associate additional email addresses with his account."); |
form_set_error('mailalias', $error); |
| 25 |
} |
} |
| 26 |
} |
} |
| 27 |
|
return $edit; |
| 28 |
?> |
} |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
/** |
| 32 |
|
* Implementation of hook_help(). |
| 33 |
|
*/ |
| 34 |
|
function mailalias_help($path, $args) { |
| 35 |
|
switch ($path) { |
| 36 |
|
case 'admin/help#mailalias': |
| 37 |
|
$output = '<p>'. t('The mail alias module associates additional e-mail aliases to user accounts. The mailhandler module uses these email aliases to authenticate incoming e-mail with your account. This is useful because many users have multiple email accounts and administrators want to aggregate their content submitted by e-mail to the single user account.') .'</p>'; |
| 38 |
|
$output .= '<p>'. t('The module is enabled on the users account settings page as a text field. e-mail aliases: where users can enter multiple e-mail addresses separated by a comma.') .'</p>'; |
| 39 |
|
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@mailalias">Mailalias page</a>.', array('@mailalias' => 'http://drupal.org/handbook/modules/mailalias/')) .'</p>'; |
| 40 |
|
return $output; |
| 41 |
|
} |
| 42 |
|
} |