From: moodler <moodler>
Date: Wed, 24 Mar 2004 12:23:43 +0000 (+0000)
Subject: Guests can no longer see email addresses if "show only to course participants"
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d0ec93fbd633b1601b9aca10be19ddaf97ae9081;p=moodle.git

Guests can no longer see email addresses if "show only to course participants"
has been set by that user
---

diff --git a/lib/weblib.php b/lib/weblib.php
index 4a47942c5b..11616123a5 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -1230,7 +1230,7 @@ function print_user($user, $course) {
     if (!empty($user->role) and ($user->role <> $course->teacher)) {
         echo "$string->role: $user->role<br />";
     }
-    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or $isteacher) {
+    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category and !isguest()) or $isteacher) {
         echo "$string->email: <a href=\"mailto:$user->email\">$user->email</a><br />";
     }
     if ($user->city or $user->country) {
diff --git a/user/view.php b/user/view.php
index 249ed574e5..2bf5002f1c 100644
--- a/user/view.php
+++ b/user/view.php
@@ -124,7 +124,9 @@
         }
     }
 
-    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
+    if ($user->maildisplay == 1 or 
+       ($user->maildisplay == 2 and $course->category and !isguest()) or 
+       isteacher($course->id)) {
 
         if (isteacheredit($course->id) or $currentuser) {   /// Can use the enable/disable email stuff
             if (!empty($_GET['enable'])) {     /// Recieved a paramter to enable the email address