Merged lastpostid from stable
This commit is contained in:
+5
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user