MDL-48338 forum: Missing #unread in discussion post url

When a user user selects the unread messages link from the forum
discussion page, the link does not include '#unread' in the url.
This patch appends '#unread' to the url by changing the appropriate
value in the reference link assigned to $out within the function
forum_cm_info_view() of the 'lib.php'file.

A similar change is on the forum index.
This commit is contained in:
Anthony Ales 2018-04-19 14:20:08 -06:00 committed by Andrew Nicols
parent be521ca625
commit 4e9c2677e5
2 changed files with 3 additions and 3 deletions

View file

@ -240,7 +240,7 @@ if ($generalforums) {
if (isset($untracked[$forum->id])) {
$unreadlink = '-';
} else if ($unread = forum_tp_count_forum_unread_posts($cm, $course)) {
$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>';
$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'#unread">'.$unread.'</a>';
$icon = $OUTPUT->pix_icon('t/markasread', $strmarkallread);
$unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?f='.
$forum->id.'&amp;mark=read&amp;sesskey=' . sesskey() . '">' . $icon . '</a></span>';
@ -371,7 +371,7 @@ if ($course->id != SITEID) { // Only real courses have learning forums
if (isset($untracked[$forum->id])) {
$unreadlink = '-';
} else if ($unread = forum_tp_count_forum_unread_posts($cm, $course)) {
$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>';
$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'#unread">'.$unread.'</a>';
$icon = $OUTPUT->pix_icon('t/markasread', $strmarkallread);
$unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?f='.
$forum->id.'&amp;mark=read&sesskey=' . sesskey() . '">' . $icon . '</a></span>';

View file

@ -7497,7 +7497,7 @@ function forum_cm_info_view(cm_info $cm) {
if (forum_tp_can_track_forums()) {
if ($unread = forum_tp_count_forum_unread_posts($cm, $cm->get_course())) {
$out = '<span class="unread"> <a href="' . $cm->url . '">';
$out = '<span class="unread"> <a href="' . $cm->url . '#unread">';
if ($unread == 1) {
$out .= get_string('unreadpostsone', 'forum');
} else {