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
if (!forum_user_can_view_post($parent)){
error ('you can not view this post');
if (!forum_user_can_view_post($parent,$course)){
error('You do not have permissions to view this post');
}
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
function forum_user_can_view_post($post, $user=NULL){
function forum_user_can_view_post($post, $course, $user=NULL){
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
if (!(isstudent($forumcourse->course) or isteacher($forumcourse->course))){
if (!(isstudent($forumcourse->course) or
isteacher($forumcourse->course) or
(isguest() && $course->guest) )){
return false;
}