| 1 |
weitzman |
1.1 |
<?php
|
| 2 |
weitzman |
1.13 |
// $Id: mailalias.module,v 1.12 2007/12/16 15:01:22 weitzman Exp $
|
| 3 |
weitzman |
1.1 |
|
| 4 |
weitzman |
1.13 |
/**
|
| 5 |
|
|
* Implementation of hook_user().
|
| 6 |
|
|
*/
|
| 7 |
ankur |
1.9 |
function mailalias_user($type, &$edit, &$user, $category = NULL) {
|
| 8 |
|
|
if ($type == 'form' && $category == 'account') {
|
| 9 |
|
|
// when user tries to edit his own data $output =
|
| 10 |
weitzman |
1.11 |
$form['account']['mailalias'] = array(
|
| 11 |
|
|
'#type' => 'textfield',
|
| 12 |
|
|
'#title' => t('Email aliases'),
|
| 13 |
|
|
'#default_value' => $user->mailalias,
|
| 14 |
|
|
'#weight' => 1,
|
| 15 |
|
|
'#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 |
ankur |
1.9 |
}
|
| 19 |
|
|
else if ($type == 'validate' && $category == 'account') {
|
| 20 |
weitzman |
1.13 |
$mailalias = strtr($edit["mailalias"], array(" " => "")); // strip spaces
|
| 21 |
ankur |
1.9 |
$mailsarr = explode(",", $mailalias);
|
| 22 |
|
|
foreach ($mailsarr as $mail) {
|
| 23 |
weitzman |
1.13 |
if ($mail != NULL && $error = user_validate_mail($mail)) {
|
| 24 |
weitzman |
1.11 |
form_set_error('mailalias', $error);
|
| 25 |
weitzman |
1.1 |
}
|
| 26 |
ankur |
1.9 |
}
|
| 27 |
|
|
return $edit;
|
| 28 |
weitzman |
1.1 |
}
|
| 29 |
|
|
}
|
| 30 |
|
|
|
| 31 |
webchick |
1.10 |
/**
|
| 32 |
|
|
* Implementation of hook_help().
|
| 33 |
|
|
*/
|
| 34 |
weitzman |
1.13 |
function mailalias_help($path, $args) {
|
| 35 |
|
|
switch ($path) {
|
| 36 |
webchick |
1.10 |
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 |
weitzman |
1.13 |
$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 |
webchick |
1.10 |
return $output;
|
| 41 |
weitzman |
1.3 |
}
|
| 42 |
weitzman |
1.1 |
}
|