From: stronk7 Date: Sat, 26 Apr 2003 00:17:42 +0000 (+0000) Subject: Show activity log only from visible forums. Bug #367. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dff0db9ad5a54db8f493a856a5f7d106acd74039;p=moodle.git Show activity log only from visible forums. Bug #367. --- diff --git a/mod/forum/lib.php b/mod/forum/lib.php index ce72620ee5..2559d5cd43 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -306,32 +306,43 @@ function forum_print_recent_activity(&$logs, $isteacher=false) { foreach ($logs as $log) { if ($log->module == "forum") { - - if ($post = forum_get_post_from_log($log)) { - $teacherpost = ""; - if ($forum = get_record("forum", "id", $post->forum) ) { - if ($forum->type == "teacher") { - if ($isteacher) { - $teacherpost = "COLOR=$COURSE_TEACHER_COLOR"; - } else { - continue; + //Get post info, I'll need it later + $post = forum_get_post_from_log($log); + + //Create a temp valid module structure (course,id) + $tempmod->course = $log->course; + $tempmod->id = $post->forum; + //Obtain the visible property from the instance + $modvisible = instance_is_visible($log->module,$tempmod); + + //Only if the mod is visible + if ($modvisible) { + if ($post) { + $teacherpost = ""; + if ($forum = get_record("forum", "id", $post->forum) ) { + if ($forum->type == "teacher") { + if ($isteacher) { + $teacherpost = "COLOR=$COURSE_TEACHER_COLOR"; + } else { + continue; + } } } + if (! $heading) { + print_headline(get_string("newforumposts", "forum").":"); + $heading = true; + $content = true; + } + $date = userdate($post->modified, $strftimerecent); + echo "

$date - $post->firstname $post->lastname
"; + echo "\"wwwroot/mod/forum/$log->url\">"; + if ($log->action == "add") { + echo "$post->subject"; + } else { + echo "$post->subject"; + } + echo "\"

"; } - if (! $heading) { - print_headline(get_string("newforumposts", "forum").":"); - $heading = true; - $content = true; - } - $date = userdate($post->modified, $strftimerecent); - echo "

$date - $post->firstname $post->lastname
"; - echo "\"wwwroot/mod/forum/$log->url\">"; - if ($log->action == "add") { - echo "$post->subject"; - } else { - echo "$post->subject"; - } - echo "\"

"; } } }