MDL-30540 - BLOG - Fixing context problems for single blog entries - Thanks Aparup and Sam for the help

This commit is contained in:
Jason Fowler 2011-12-09 15:02:44 +08:00
parent baa5cd8240
commit ae6313d4a7
2 changed files with 9 additions and 11 deletions

View File

@ -197,20 +197,18 @@ if (!empty($userid)) {
$courseid = (empty($courseid)) ? SITEID : $courseid;
if (!empty($courseid)) {
$PAGE->set_context(get_context_instance(CONTEXT_COURSE, $courseid));
}
if (!empty($modid)) {
$PAGE->set_context(get_context_instance(CONTEXT_MODULE, $modid));
if (empty($entryid) && empty($modid) && empty($groupid)) {
$PAGE->set_context(context_user::instance($USER->id));
} else if (!empty($modid)) {
$PAGE->set_context(context_module::instance($modid));
} else if (!empty($courseid)) {
$PAGE->set_context(context_course::instance($courseid));
} else {
$PAGE->set_context(context_system::instance());
}
$blogheaders = blog_get_headers();
if (empty($entryid) && empty($modid) && empty($groupid)) {
$PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id));
}
if ($CFG->enablerssfeeds) {
$rsscontext = null;
$filtertype = null;

View File

@ -314,7 +314,7 @@ function blog_get_context_url($context=null) {
// Change contextlevel to SYSTEM if viewing the site course
if ($context->contextlevel == CONTEXT_COURSE && $context->instanceid == SITEID) {
$context->contextlevel = CONTEXT_SYSTEM;
$context = context_system::instance();
}
$filterparam = '';