]> git.mjollnir.org Git - moodle.git/commitdiff
One notice is out showing recent recent activity of deleted posts.
authorstronk7 <stronk7>
Tue, 1 Feb 2005 23:57:58 +0000 (23:57 +0000)
committerstronk7 <stronk7>
Tue, 1 Feb 2005 23:57:58 +0000 (23:57 +0000)
mod/forum/lib.php

index 2ec7b36b9ae1984fef052cafe1db4956a5cc8fd6..f4811183cc109658e6224038ffa8d12d4c2b233f 100644 (file)
@@ -740,63 +740,61 @@ function forum_print_recent_activity($course, $isteacher, $timestart) {
 
     foreach ($logs as $log) {
         //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) {
-                /// Check whether this is for teachers only
-                $teacheronly = "";
-                if ($forum = get_record("forum", "id", $post->forum)) {
-                    if ($forum->type == "teacher") {
-                        if ($isteacher) {
-                            $teacheronly = "class=\"teacheronly\"";
-                        } else {
-                            continue;
-                        }
+        if ($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 post exists and mod is visible
+        if ($post && $modvisible) {
+            /// Check whether this is for teachers only
+            $teacheronly = "";
+            if ($forum = get_record("forum", "id", $post->forum)) {
+                if ($forum->type == "teacher") {
+                    if ($isteacher) {
+                        $teacheronly = "class=\"teacheronly\"";
+                    } else {
+                        continue;
                     }
                 }
-                /// Check whether this is belongs to a discussion in a group that
-                /// should NOT be accessible to the current user
+            }
+            /// Check whether this is belongs to a discussion in a group that
+            /// should NOT be accessible to the current user
 
-                if (!$isteacheredit and $post->groupid != -1) {   /// Editing teachers or open discussions
-                    if (!isset($cm[$post->forum])) {
-                        $cm[$forum->id] = get_coursemodule_from_instance("forum", $forum->id, $course->id);
-                        $groupmode[$forum->id] = groupmode($course, $cm[$forum->id]);
-                    }
-                    if ($groupmode[$forum->id]) {
-                        if ($mygroupid != $post->groupid) {
-                            continue;
-                        }
+            if (!$isteacheredit and $post->groupid != -1) {   /// Editing teachers or open discussions
+                if (!isset($cm[$post->forum])) {
+                    $cm[$forum->id] = get_coursemodule_from_instance("forum", $forum->id, $course->id);
+                    $groupmode[$forum->id] = groupmode($course, $cm[$forum->id]);
+                }
+                if ($groupmode[$forum->id]) {
+                    if ($mygroupid != $post->groupid) {
+                        continue;
                     }
                 }
+            }
 
-                if (! $heading) {
-                    print_headline(get_string("newforumposts", "forum").":");
-                    $heading = true;
-                    $content = true;
-                }
-                $date = userdate($post->modified, $strftimerecent);
-                $fullname = fullname($post, $isteacher);
-                echo "<p $teacheronly><font size=\"1\">$date - $fullname<br />";
-                echo "\"<a href=\"$CFG->wwwroot/mod/forum/".str_replace('&', '&amp;', $log->url)."\">";
-                $post->subject = break_up_long_words($post->subject);
-                if (!empty($CFG->filterall)) {
-                    $post->subject = filter_text("<nolink>$post->subject</nolink>", $course->id);
-                }
-                if ($log->action == "add discussion") {
-                    echo "<b>$post->subject</b>";
-                } else {
-                    echo "$post->subject";
-                }
-                echo "</a>\"</font></p>";
+            if (! $heading) {
+                print_headline(get_string("newforumposts", "forum").":");
+                $heading = true;
+                $content = true;
+            }
+            $date = userdate($post->modified, $strftimerecent);
+            $fullname = fullname($post, $isteacher);
+            echo "<p $teacheronly><font size=\"1\">$date - $fullname<br />";
+            echo "\"<a href=\"$CFG->wwwroot/mod/forum/".str_replace('&', '&amp;', $log->url)."\">";
+            $post->subject = break_up_long_words($post->subject);
+            if (!empty($CFG->filterall)) {
+                $post->subject = filter_text("<nolink>$post->subject</nolink>", $course->id);
+            }
+            if ($log->action == "add discussion") {
+                echo "<b>$post->subject</b>";
+            } else {
+                echo "$post->subject";
             }
+            echo "</a>\"</font></p>";
         }
     }