Skip to content

Commit

Permalink
MDL-34910 blog Fixing mod level related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Oct 31, 2012
1 parent 8458274 commit 207b6fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions blog/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ function validation($data, $files) {
$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);

Expand Down
4 changes: 2 additions & 2 deletions blog/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,12 @@ public function print_entries() {
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;
}
Expand Down

0 comments on commit 207b6fc

Please sign in to comment.