Skip to content
Browse files

Users can now choose to hide their email address. In this initial ver…

…sion

there are three options:

0) Hide the email address from everyone (except the teacher of their course)
1) Allow everyone to see the email address, all the time.
2) Allow only participants in the same course to see the email address

Note, new field maildisplay in 'user'
  • Loading branch information...
1 parent 7363ff9 commit 55e078c0fa48ca63bbd841f42c6a9aa3cf574d25 martin committed Aug 21, 2002
Showing with 24 additions and 3 deletions.
  1. +4 −0 lang/en/moodle.php
  2. +9 −0 user/edit.html
  3. +3 −1 user/lib.php
  4. +3 −1 user/view.php
  5. +5 −1 version.php
View
4 lang/en/moodle.php
@@ -99,6 +99,10 @@
Cheers from the '\$a->sitename' administrator,
\$a->admin";
+$string[emaildisplay] = "Email display";
+$string[emaildisplayno] = "Hide my real email address from everyone";
+$string[emaildisplayyes] = "Allow everyone to see my email address";
+$string[emaildisplaycourse] = "Allow only other course members to see my email address";
$string[emailexists] = "This email address is already registered.";
$string[emailmustbereal] = "Note: your email address must be a real one";
$string[enrolmentkey] = "Enrolment key";
View
9 user/edit.html
@@ -67,6 +67,15 @@
</td>
</tr>
<tr valign=top>
+ <td><P><? print_string("emaildisplay") ?>:</td>
+ <td><?
+ $choices["0"] = get_string("emaildisplayno");
+ $choices["1"] = get_string("emaildisplayyes");
+ $choices["2"] = get_string("emaildisplaycourse");
+ choose_from_menu ($choices, "maildisplay", $user->maildisplay, "") ?>
+ </td>
+</tr>
+<tr valign=top>
<td><P><? print_string("webpage") ?>:</td>
<td><input type="text" name="url" size=30 value="<? p($user->url) ?>">
<? formerr($err["url"]) ?>
View
4 user/lib.php
@@ -58,7 +58,9 @@ function print_user($user, $course, $string) {
echo "<FONT SIZE=-1>";
echo "<FONT SIZE=3><B>$user->firstname $user->lastname</B></FONT>";
echo "<P>";
- echo "$string->email: <A HREF=\"mailto:$user->email\">$user->email</A><BR>";
+ if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
+ echo "$string->email: <A HREF=\"mailto:$user->email\">$user->email</A><BR>";
+ }
echo "$string->location: $user->city, ".$COUNTRIES["$user->country"]."<BR>";
echo "$string->lastaccess: ".userdate($user->lastaccess);
echo "&nbsp (".format_time(time() - $user->lastaccess).")";
View
4 user/view.php
@@ -94,7 +94,9 @@
}
}
- print_row(get_string("email").":", "<A HREF=\"mailto:$user->email\">$user->email</A>");
+ if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
+ print_row(get_string("email").":", "<A HREF=\"mailto:$user->email\">$user->email</A>");
+ }
if ($user->url) {
print_row(get_string("webpage").":", "<A HREF=\"$user->url\">$user->url</A>");
View
6 version.php
@@ -17,7 +17,7 @@
// If there's something it cannot do itself, it
// will tell you what you need to do.
-$version = 2002082100;
+$version = 2002082101;
function upgrade_moodle($oldversion=0) {
@@ -51,6 +51,10 @@ function upgrade_moodle($oldversion=0) {
execute_sql(" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL ");
}
+ if ($oldversion < 2002082101) {
+ execute_sql(" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` ");
+ }
+
return true;
}

0 comments on commit 55e078c

Please sign in to comment.
Something went wrong with that request. Please try again.