| 1 |
<?php
|
| 2 |
// $Id: mailalias.module,v 1.11 2006/04/09 04:28:18 weitzman Exp $
|
| 3 |
|
| 4 |
function mailalias_user($type, &$edit, &$user, $category = NULL) {
|
| 5 |
if ($type == 'form' && $category == 'account') {
|
| 6 |
// when user tries to edit his own data $output =
|
| 7 |
$form['account']['mailalias'] = array(
|
| 8 |
'#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') {
|
| 17 |
$mailalias = strtr($edit["mailalias"], array (" " => "")); // strip spaces
|
| 18 |
$mailsarr = explode(",", $mailalias);
|
| 19 |
foreach ($mailsarr as $mail) {
|
| 20 |
if ($mail != null && $error = user_validate_mail($mail)) {
|
| 21 |
form_set_error('mailalias', $error);
|
| 22 |
}
|
| 23 |
}
|
| 24 |
return $edit;
|
| 25 |
}
|
| 26 |
}
|
| 27 |
|
| 28 |
/**
|
| 29 |
* Implementation of hook_help().
|
| 30 |
*/
|
| 31 |
function mailalias_help($section) {
|
| 32 |
switch ($section) {
|
| 33 |
case 'admin/help#mailalias':
|
| 34 |
$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>';
|
| 35 |
$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>';
|
| 36 |
$output .= t('<p>You can</p>
|
| 37 |
<ul>
|
| 38 |
<li>view the user page at <a href="%user"> user</a>.</li>
|
| 39 |
<li>adminster users at <a href="%admin-user">administer >> users</a>.</li>
|
| 40 |
<li>administer mailhandler at <a href="%admin-mailhandler">administer >> mailhandler</a>.</li>
|
| 41 |
', array('%user' => url('user'), '%admin-user' => url('admin/user'), '%admin-mailhandler' => url('admin/mailhandler'))) .'</ul>';
|
| 42 |
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%mailalias">Mailalias page</a>.', array('%mailalias' => 'http://www.drupal.org/handbook/modules/mailalias/')) .'</p>';
|
| 43 |
return $output;
|
| 44 |
case "admin/modules#description":
|
| 45 |
return t("A user may associate additional email addresses with his account.");
|
| 46 |
}
|
| 47 |
}
|
| 48 |
|
| 49 |
?>
|