Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

user MDL-24724 added email to user course profile

  • Loading branch information...
commit 8d22e342a97fec39ab8b7650e7d0ba91fca5827e 1 parent 2b37004
@andyjdavis andyjdavis authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 user/view.php
9 user/view.php
@@ -236,6 +236,15 @@
echo '<table class="list" summary="">';
+//checks were performed above that ensure that if we've got to here either the user
+//is viewing their own profile ($USER->id == $user->id) or $user is enrolled in the course
+if ($currentuser
+ or $user->maildisplay == 1 //allow everyone to see email address
+ or ($user->maildisplay == 2 && is_enrolled($coursecontext, $USER)) //fellow course members can see email. Already know $user is enrolled
+ or has_capability('moodle/course:useremail', $coursecontext)) {
+ print_row(get_string("email").":", obfuscate_mailto($user->email, ''));
// Show last time this user accessed this course
if (!isset($hiddenfields['lastaccess'])) {
if ($lastaccess = $DB->get_record('user_lastaccess', array('userid'=>$user->id, 'courseid'=>$course->id))) {
Please sign in to comment.
Something went wrong with that request. Please try again.