Merged bugfix for bug 4431 from stable

This commit is contained in:
moodler 2005-12-22 10:09:21 +00:00
parent 8321c7b1d5
commit e6bacdc55c
2 changed files with 6 additions and 4 deletions

View file

@ -104,8 +104,8 @@
} }
//check if user can view this post //check if user can view this post
if (!forum_user_can_view_post($parent)){ if (!forum_user_can_view_post($parent,$course)){
error ('you can not view this post'); error('You do not have permissions to view this post');
} }
if (! $post = forum_get_post_full($parent)) { if (! $post = forum_get_post_full($parent)) {

View file

@ -2658,7 +2658,7 @@ function forum_user_can_post($forum, $user=NULL) {
} }
//checks to see if a user can view a particular post //checks to see if a user can view a particular post
function forum_user_can_view_post($post, $user=NULL){ function forum_user_can_view_post($post, $course, $user=NULL){
global $CFG, $USER; global $CFG, $USER;
@ -2684,7 +2684,9 @@ function forum_user_can_view_post($post, $user=NULL){
} }
//first of all, the user must be in this course //first of all, the user must be in this course
if (!(isstudent($forumcourse->course) or isteacher($forumcourse->course))){ if (!(isstudent($forumcourse->course) or
isteacher($forumcourse->course) or
(isguest() && $course->guest) )){
return false; return false;
} }