diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 4ffce5e9ff8..8945e0e4a2a 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -99,6 +99,10 @@ line at the top of your web browser window. 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"; diff --git a/user/edit.html b/user/edit.html index 4e80e86636f..159e51fc48e 100644 --- a/user/edit.html +++ b/user/edit.html @@ -66,6 +66,15 @@ if (isadmin()) { choose_from_menu ($choices, "mailformat", $user->mailformat, "") ?> +
print_string("emaildisplay") ?>:
print_string("webpage") ?>:
";
- echo "$string->email: email\">$user->email
";
+ if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
+ echo "$string->email: email\">$user->email
";
+ }
echo "$string->location: $user->city, ".$COUNTRIES["$user->country"]."
";
echo "$string->lastaccess: ".userdate($user->lastaccess);
echo "  (".format_time(time() - $user->lastaccess).")";
diff --git a/user/view.php b/user/view.php
index 5c36475bdb4..17e67cb5fc4 100644
--- a/user/view.php
+++ b/user/view.php
@@ -94,7 +94,9 @@
}
}
- print_row(get_string("email").":", "email\">$user->email");
+ if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
+ print_row(get_string("email").":", "email\">$user->email");
+ }
if ($user->url) {
print_row(get_string("webpage").":", "url\">$user->url");
diff --git a/version.php b/version.php
index 9c75019172b..78a9d6b0d38 100644
--- a/version.php
+++ b/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;
}