Merged lastpostid from stable

This commit is contained in:
moodler
2004-11-30 02:53:08 +00:00
parent f025416cb0
commit 1c58180bce
+5 -1
View File
@@ -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 {