]> git.mjollnir.org Git - moodle.git/commitdiff
Merged lastpostid from stable
authormoodler <moodler>
Tue, 30 Nov 2004 02:53:08 +0000 (02:53 +0000)
committermoodler <moodler>
Tue, 30 Nov 2004 02:53:08 +0000 (02:53 +0000)
mod/forum/rate.php

index d3ae2bd7e5d0aa0e1cee2ddd1e1bcc7e2ca55725..990f5c6c7a4eb44f1a4431ff6271b7bd19c9daa5 100644 (file)
 
     if ($data) {
 
+        $lastpostid = 0;
+
         foreach ((array)$data as $postid => $rating) {
             if ($postid == "id") {
                 continue;
             }
 
+            $lastpostid = $postid;
+
             if ($oldrating = get_record("forum_ratings", "userid", $USER->id, "post", $postid)) {
                 if ($rating != $oldrating->rating) {
                     $oldrating->rating = $rating;
@@ -54,7 +58,7 @@
                 }
             }
         }
-        if ($post = get_record('forum_posts', 'id', $postid)) {
+        if ($post = get_record('forum_posts', 'id', $lastpostid)) {    // To find discussion we're in
             if ($returntoview and ($discussion = get_record('forum_discussions', 'id', $post->discussion))) {
                 redirect("$CFG->wwwroot/mod/forum/view.php?f=$discussion->forum", get_string("ratingssaved", "forum"));
             } else {