Skip to content

Commit

Permalink
MDL-30467 no course profile for deleted users
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Nov 26, 2011
1 parent 1de9151 commit 589071b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions user/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$usercontext = get_context_instance(CONTEXT_USER, $user->id, MUST_EXIST);
$usercontext = get_context_instance(CONTEXT_USER, $user->id, IGNORE_MISSING);

// Require login first
if (isguestuser($user)) {
Expand All @@ -68,7 +68,7 @@

$isparent = false;

if (!$currentuser
if (!$currentuser and !$user->deleted
and $DB->record_exists('role_assignments', array('userid'=>$USER->id, 'contextid'=>$usercontext->id))
and has_capability('moodle/user:viewdetails', $usercontext)) {
// TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in,
Expand Down Expand Up @@ -109,7 +109,7 @@

// check course level capabilities
if (!has_capability('moodle/user:viewdetails', $coursecontext) && // normal enrolled user or mnager
!has_capability('moodle/user:viewdetails', $usercontext)) { // usually parent
($user->deleted or !has_capability('moodle/user:viewdetails', $usercontext))) { // usually parent
print_error('cannotviewprofile');
}

Expand Down

0 comments on commit 589071b

Please sign in to comment.