| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: mailalias.module,v 1.8 2004/10/01 00:08:33 uwe Exp $ |
| 3 |
|
|
| 4 |
function mailalias_user($type, $edit, $user) { |
function mailalias_user($type, &$edit, &$user, $category = NULL) { |
| 5 |
switch ($type) { |
if ($type == 'form' && $category == 'account') { |
| 6 |
case "form": |
// when user tries to edit his own data $output = |
| 7 |
// when user tries to edit his own data $output = |
$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.')); |
| 8 |
$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.")); |
return array(array('title' => t('Personal information'), 'data' => $output, 'weight' => 2)); |
| 9 |
return array (t('Personal information') => $output); |
} |
| 10 |
case "validate": |
else if ($type == 'validate' && $category == 'account') { |
| 11 |
// validate user data editing. TODO |
$mailalias = strtr($edit["mailalias"], array (" " => "")); // strip spaces |
| 12 |
$mailalias = strtr($edit["mailalias"], array (" " => "")); // strip spaces |
$mailsarr = explode(",", $mailalias); |
| 13 |
$mailsarr = explode(",", $mailalias); |
foreach ($mailsarr as $mail) { |
| 14 |
foreach ($mailsarr as $mail) { |
if ($mail != null && $error = user_validate_mail($mail)) { |
| 15 |
if ($mail != null && $error = user_validate_mail($mail)) { |
form_set_error(t('Mail Alias'), $error); |
|
return $error; |
|
|
} |
|
| 16 |
} |
} |
| 17 |
return array ("mailalias" => $mailalias); |
} |
| 18 |
|
return $edit; |
| 19 |
} |
} |
| 20 |
} |
} |
| 21 |
|
|
| 22 |
function mailalias_help($section) { |
function mailalias_help($section) { |
| 23 |
if ($section == "admin/system/modules#description") { |
if ($section == "admin/modules#description") { |
| 24 |
return t("A user may associate additional email addresses with his account."); |
return t("A user may associate additional email addresses with his account."); |
| 25 |
} |
} |
| 26 |
} |
} |