Permalink
Browse files

Fix for MDL-8404.

Admin couldn't edit posts for each user one discussion forums.
  • Loading branch information...
1 parent ad8c93d commit 62154f84d78c35ccd394666faa8e64939da8c685 vyshane committed Feb 9, 2007
Showing with 8 additions and 4 deletions.
  1. +3 −3 mod/forum/lib.php
  2. +5 −1 mod/forum/post.php
View
@@ -2724,11 +2724,11 @@ function forum_user_has_posted($forumid,$did,$userid) {
function forum_user_can_post_discussion($forum, $currentgroup=false, $groupmode='', $edit=0) {
// $forum is an object
- global $USER, $SESSION;
+ global $CFG, $USER, $SESSION;
if ($forum->type == "eachuser") {
- if ($edit) { // fix for 5551, if 1 post per user, should allow edit, if poster is owner
+ if ($edit) {
$post = get_record('forum_posts','id',$edit);
- return ($post->userid == $USER->id); // editting your own post?
+ return ($post->userid == $USER->id || isadmin() && $CFG->admineditalways);
} else {
return (! forum_user_has_posted_discussion($forum->id, $USER->id));
}
View
@@ -756,7 +756,11 @@
error("You cannot reply to this post");
}
if (empty($parent) && !forum_user_can_post_discussion($forum, false, '', $edit)) {
- error("You cannot start a new discussion in this forum");
+ if (!$edit) {
+ error("You cannot start a new discussion in this forum");
+ } else {
+ error("You cannot edit this post");
+ }
}
if ($forum->type == 'qanda' && !isteacher($forum->course) && !forum_user_has_posted($forum->id,$discussion->id,$USER->id)) {

0 comments on commit 62154f8

Please sign in to comment.