Skip to content

Commit

Permalink
MDL-31894 Blocks: fixed get_course_context usage in peoples block
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh Taneja committed Mar 6, 2012
1 parent f24a1a7 commit 7d01921
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion blocks/participants/block_participants.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ function get_content() {
$this->content->footer = '';

// user/index.php expect course context, so get one if page has module context.
$currentcontext = $this->page->context->get_course_context(false);
// Do explicit check on context as we don't want to throw any exception on context
// above course level.
$currentcontext = NULL;
if (($this->page->context->contextlevel == CONTEXT_COURSE) ||
($this->page->context->contextlevel == CONTEXT_MODULE) ||
($this->page->context->contextlevel == CONTEXT_BLOCK)) {
$currentcontext = get_course_context($this->page->context);
}

if (empty($currentcontext)) {
$this->content = '';
Expand Down

0 comments on commit 7d01921

Please sign in to comment.