diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 6d9097c58a8..77eb6f1fdba 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -2046,6 +2046,9 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link $commands[] = ''.$strparent.''; } + $editownpost = $ownpost && has_capability('mod/forum:replypost', $modcontext); + } else { + $editownpost = $ownpost && has_capability('mod/forum:startdiscussion', $modcontext); } $forumtype = get_field('forum', 'type', 'id', $post->forum); @@ -2058,7 +2061,10 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link $age = 0; } $editanypost = has_capability('mod/forum:editanypost', $modcontext); - if ($ownpost or $editanypost) { + + + + if ($editownpost or $editanypost) { if (($age < $CFG->maxeditingtime) or $editanypost) { $commands[] = ''.$stredit.''; } @@ -2071,12 +2077,13 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link '" title="'.$strpruneheading.'">'.$strprune.''; } - if (($ownpost and $age < $CFG->maxeditingtime) or - has_capability('mod/forum:editanypost', $modcontext)) { + if (($ownpost and $age < $CFG->maxeditingtime + and has_capability('mod/forum:deleteownpost', $modcontext)) + or has_capability('mod/forum:deleteanypost', $modcontext)) { $commands[] = ''.$strdelete.''; } - if ($reply) { + if ($reply and has_capability('mod/forum:replypost', $modcontext)) { $commands[] = ''.$strreply.''; }