Skip to content

Commit

Permalink
MDL-26882 profile: Apllying the cap check site:viewuseridentity to us…
Browse files Browse the repository at this point in the history
…er profile
  • Loading branch information
ankitagarwal committed Aug 30, 2012
1 parent bac15e5 commit 74c0b55
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions user/profile.php
Expand Up @@ -118,6 +118,12 @@
$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
$strpublicprofile = get_string('publicprofile');

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

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

if (isset($identityfields['phone1']) && $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");
}
}

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
Expand Down

0 comments on commit 74c0b55

Please sign in to comment.