/[drupal]/contributions/modules/mailalias/mailalias.module
ViewVC logotype

Contents of /contributions/modules/mailalias/mailalias.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Tue Dec 16 17:00:27 2003 UTC (5 years, 11 months ago) by mathias
Branch: MAIN
Branch point for: drop
Changes since 1.3: +2 -2 lines
File MIME type: text/x-php
The behaviour of user_validate_mail was changed to match
 that of user_validate_name and throw an error on null cases.  This module needed to be updated. As a result, it was thus forcing users
 to enter a mail alias.
1 <?php
2
3 function mailalias_user($type, $edit, $user) {
4 switch ($type) {
5 case "view_private":
6 // when user looks at his own data
7 $output = form_item(t("Email aliases"), $user->mailalias);
8 return $output;
9 case "edit_form":
10 // when user tries to edit his own data $output =
11 $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."));
12 return $output;
13 case "edit_validate":
14 // validate user data editing. TODO
15 $mailalias = strtr($edit["mailalias"], array (" " => "")); // strip spaces
16 $mailsarr = explode(",", $mailalias);
17 foreach ($mailsarr as $mail) {
18 if ($mail != null && $error = user_validate_mail($mail)) {
19 return $error;
20 }
21 }
22 return array ("mailalias" => $mailalias);
23 }
24 }
25
26 function mailalias_help($section) {
27 if ($section == "admin/system/modules#description") {
28 return t("A user may associate additional email addresses with his account.");
29 }
30 }
31
32 ?>

  ViewVC Help
Powered by ViewVC 1.1.2