From 44cbe13aeaa8f6048a0eb2e64e3a2cb34092638f Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Thu, 23 Feb 2012 16:15:08 +0800 Subject: [PATCH] MDL-29274 blocks: people block will use course context for making url and not module context --- blocks/participants/block_participants.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/blocks/participants/block_participants.php b/blocks/participants/block_participants.php index 5779210ab75af..deeeb7d9989ee 100644 --- a/blocks/participants/block_participants.php +++ b/blocks/participants/block_participants.php @@ -19,10 +19,13 @@ function get_content() { $this->content->icons = array(); $this->content->footer = ''; - /// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php - $currentcontext = $this->page->context; + // user/index.php expect course context, so get one if page has module context. + $currentcontext = $this->page->context->get_course_context(false); - if ($this->page->course->id == SITEID) { + if (empty($currentcontext)) { + $this->content = ''; + return $this->content; + } else if ($this->page->course->id == SITEID) { if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) { $this->content = ''; return $this->content; @@ -33,6 +36,7 @@ function get_content() { return $this->content; } } + $icon = ' '; $this->content->items[] = ''.$icon.get_string('participants').''; @@ -46,5 +50,3 @@ function applicable_formats() { } } - -