From 207b6fc5f19f2b7f6a4d4abb9fdb21baee6849ff Mon Sep 17 00:00:00 2001 From: David Monllao Date: Wed, 31 Oct 2012 11:56:36 +0800 Subject: [PATCH] MDL-34910 blog Fixing mod level related issues --- blog/edit_form.php | 4 ++-- blog/locallib.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/blog/edit_form.php b/blog/edit_form.php index b66a6e4f34b..919fed1caac 100644 --- a/blog/edit_form.php +++ b/blog/edit_form.php @@ -158,8 +158,8 @@ class blog_edit_form extends moodleform { $modcontextid = $data['modassoc']; $modcontext = context::instance_by_id($modcontextid, IGNORE_MISSING); - $canassociatemodule = has_capability('moodle/blog:associatecourse', $modcontext); - if ($modcontext->contextlevel == CONTEXT_MODULE && $canassociatemodule) { + $canassociatemodule = has_capability('moodle/blog:associatemodule', $modcontext); + if ($canassociatemodule) { // get context of the mod's course $coursecontext = $modcontext->get_course_context(true); diff --git a/blog/locallib.php b/blog/locallib.php index 168faf1212b..304b3da4191 100644 --- a/blog/locallib.php +++ b/blog/locallib.php @@ -665,12 +665,12 @@ class blog_listing { if (empty($userid) || (!empty($userid) && $userid == $USER->id)) { $canaddentries = true; + $courseid = optional_param('courseid', null, PARAM_INT); if ($modid = optional_param('modid', null, PARAM_INT)) { if (!has_capability('moodle/blog:associatemodule', context_module::instance($modid))) { $canaddentries = false; } - } - if ($courseid = optional_param('courseid', null, PARAM_INT)) { + } else if ($courseid) { if (!has_capability('moodle/blog:associatecourse', context_course::instance($courseid))) { $canaddentries = false; } -- 2.43.0