From 1c58180bce643d246342db180e8e5477e02c924c Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 30 Nov 2004 02:53:08 +0000 Subject: [PATCH] Merged lastpostid from stable --- mod/forum/rate.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/forum/rate.php b/mod/forum/rate.php index d3ae2bd7e5..990f5c6c7a 100644 --- a/mod/forum/rate.php +++ b/mod/forum/rate.php @@ -29,11 +29,15 @@ 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 { -- 2.39.5