diff --git a/mod/forum/index.php b/mod/forum/index.php
index 1e9d1fdf622..a8a38273d58 100644
--- a/mod/forum/index.php
+++ b/mod/forum/index.php
@@ -245,7 +245,7 @@ if ($generalforums) {
} else if ($unread = forum_tp_count_forum_unread_posts($cm, $course)) {
$unreadlink = ''.$unread.'';
$unreadlink .= '
';
+ $forum->id.'&mark=read&sesskey=' . sesskey() . '">
';
} else {
$unreadlink = '0';
}
@@ -383,7 +383,7 @@ if ($course->id != SITEID) { // Only real courses have learning forums
} else if ($unread = forum_tp_count_forum_unread_posts($cm, $course)) {
$unreadlink = ''.$unread.'';
$unreadlink .= '
';
+ $forum->id.'&mark=read&sesskey=' . sesskey() . '">
';
} else {
$unreadlink = '0';
}
diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index 58b9e0a9525..fe088133ac1 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -3741,7 +3741,7 @@ function forum_print_discussion_header(&$post, $forum, $group = -1, $datestring
echo $post->unread;
echo '';
echo '' .
+ $forum->id.'&d='.$post->discussion.'&mark=read&returnpage=view.php&sesskey=' . sesskey() . '">' .
'
';
echo '';
} else {
@@ -5433,7 +5433,7 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions = -1, $
if ($forumtracked) {
echo ''.
+ $forum->id.'&mark=read&returnpage=view.php&sesskey=' . sesskey() . '">'.
'
';
}
echo '';
diff --git a/mod/forum/markposts.php b/mod/forum/markposts.php
index e6b94428ad9..52fda295994 100644
--- a/mod/forum/markposts.php
+++ b/mod/forum/markposts.php
@@ -55,6 +55,7 @@ if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
$user = $USER;
require_login($course, false, $cm);
+require_sesskey();
if ($returnpage == 'index.php') {
$returnto = new moodle_url("/mod/forum/$returnpage", array('id' => $course->id));