Skip to content

Commit

Permalink
Merge branch 'MDL-26882-m22' of git://github.com/ankitagarwal/moodle …
Browse files Browse the repository at this point in the history
…into MOODLE_22_STABLE
  • Loading branch information
Sam Hemelryk committed Sep 2, 2012
2 parents 926fffa + 30de036 commit c0941ec
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions user/profile.php
Expand Up @@ -118,6 +118,12 @@
$hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields)); $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
} }


if (has_capability('moodle/site:viewuseridentity', $context)) {
$identityfields = array_flip(explode(',', $CFG->showuseridentity));
} else {
$identityfields = array();
}

// Start setting up the page // Start setting up the page
$strpublicprofile = get_string('publicprofile'); $strpublicprofile = get_string('publicprofile');


Expand Down Expand Up @@ -247,22 +253,35 @@
print_row(get_string('city') . ':', $user->city); print_row(get_string('city') . ':', $user->city);
} }


if (has_capability('moodle/user:viewhiddendetails', $context)) { if (isset($identityfields['address']) && $user->address) {
if ($user->address) { print_row(get_string("address").":", "$user->address");
print_row(get_string("address").":", "$user->address"); }
}
if ($user->phone1) { if (isset($identityfields['phone1']) && $user->phone1) {
print_row(get_string("phone").":", "$user->phone1"); print_row(get_string("phone").":", "$user->phone1");
} }
if ($user->phone2) {
if (isset($identityfields['phone2']) && $user->phone2) {
print_row(get_string("phone2").":", "$user->phone2"); print_row(get_string("phone2").":", "$user->phone2");
}
} }


if ($currentuser if (isset($identityfields['institution']) && $user->institution) {
print_row(get_string("institution").":", "$user->institution");
}

if (isset($identityfields['department']) && $user->department) {
print_row(get_string("department").":", "$user->department");
}

if (isset($identityfields['idnumber']) && $user->idnumber) {
print_row(get_string("idnumber").":", "$user->idnumber");
}

if (($currentuser
or $user->maildisplay == 1 or $user->maildisplay == 1
or has_capability('moodle/course:useremail', $context) or has_capability('moodle/course:useremail', $context)
or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER))) { or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))
and isset($identityfields['email'])) {


print_row(get_string("email").":", obfuscate_mailto($user->email, '')); print_row(get_string("email").":", obfuscate_mailto($user->email, ''));
} }
Expand Down

0 comments on commit c0941ec

Please sign in to comment.