Commit 90f4745c authored by skodak's avatar skodak
Browse files

MDL-14113 patch for multiple issues - see tracker for subtasks; merged from MOODLE_19_STABLE

parent 59d6852b
...@@ -942,7 +942,7 @@ function print_recent_activity($course) { ...@@ -942,7 +942,7 @@ function print_recent_activity($course) {
$content = $print_recent_activity($course, $viewfullnames, $timestart) || $content; $content = $print_recent_activity($course, $viewfullnames, $timestart) || $content;
} }
} else { } else {
debugging("Missing lib.php in lib/{$mod->name} - please reinstall files or uninstall the module"); debugging("Missing lib.php in lib/{$modname} - please reinstall files or uninstall the module");
} }
} }
...@@ -1255,7 +1255,6 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, ...@@ -1255,7 +1255,6 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
static $strmovehere; static $strmovehere;
static $strmovefull; static $strmovefull;
static $strunreadpostsone; static $strunreadpostsone;
static $untracked;
static $usetracking; static $usetracking;
static $groupings; static $groupings;
...@@ -1272,7 +1271,6 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, ...@@ -1272,7 +1271,6 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
include_once($CFG->dirroot.'/mod/forum/lib.php'); include_once($CFG->dirroot.'/mod/forum/lib.php');
if ($usetracking = forum_tp_can_track_forums()) { if ($usetracking = forum_tp_can_track_forums()) {
$strunreadpostsone = get_string('unreadpostsone', 'forum'); $strunreadpostsone = get_string('unreadpostsone', 'forum');
$untracked = forum_tp_get_untracked_forums($USER->id, $course->id);
} }
$initialised = true; $initialised = true;
} }
...@@ -1391,18 +1389,14 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, ...@@ -1391,18 +1389,14 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
} }
} }
if ($usetracking && $mod->modname == 'forum') { if ($usetracking && $mod->modname == 'forum') {
if ($usetracking and !isset($untracked[$mod->instance])) { if ($unread = forum_tp_count_forum_unread_posts($mod, $course)) {
$groupid = groups_get_activity_group($mod); echo '<span class="unread"> <a href="'.$CFG->wwwroot.'/mod/forum/view.php?id='.$mod->id.'">';
$unread = forum_tp_count_forum_unread_posts($USER->id, $mod->instance, $groupid); if ($unread == 1) {
if ($unread) { echo $strunreadpostsone;
echo '<span class="unread"> <a href="'.$CFG->wwwroot.'/mod/forum/view.php?id='.$mod->id.'">'; } else {
if ($unread == 1) { print_string('unreadpostsnumber', 'forum', $unread);
echo $strunreadpostsone;
} else {
print_string('unreadpostsnumber', 'forum', $unread);
}
echo '</a> </span>';
} }
echo '</a></span>';
} }
} }
......
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
if (!empty($USER->id)) { if (!empty($USER->id)) {
$SESSION->fromdiscussion = $CFG->wwwroot; $SESSION->fromdiscussion = $CFG->wwwroot;
if (forum_is_subscribed($USER->id, $newsforum->id)) { if (forum_is_subscribed($USER->id, $newsforum)) {
$subtext = get_string('unsubscribe', 'forum'); $subtext = get_string('unsubscribe', 'forum');
} else { } else {
$subtext = get_string('subscribe', 'forum'); $subtext = get_string('subscribe', 'forum');
......
...@@ -53,6 +53,35 @@ function xmldb_forum_upgrade($oldversion=0) { ...@@ -53,6 +53,35 @@ function xmldb_forum_upgrade($oldversion=0) {
$db->debug = true; $db->debug = true;
} }
if ($result && $oldversion < 2007101512) {
/// Cleanup the forum subscriptions
notify('Removing stale forum subscriptions', 'notifysuccess');
$roles = get_roles_with_capability('moodle/course:view', CAP_ALLOW);
$roles = array_keys($roles);
$roles = implode(',', $roles);
$sql = "SELECT fs.userid, f.id AS forumid
FROM {$CFG->prefix}forum f
JOIN {$CFG->prefix}course c ON c.id = f.course
JOIN {$CFG->prefix}context ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = ".CONTEXT_COURSE.")
JOIN {$CFG->prefix}forum_subscriptions fs ON fs.forum = f.id
LEFT JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = ctx.id AND ra.userid = fs.userid AND ra.roleid IN ($roles))
WHERE ra.id IS NULL";
if ($rs = get_recordset_sql($sql)) {
$db->debug = false;
while ($remove = rs_fetch_next_record($rs)) {
delete_records('forum_subscriptions', 'userid', $remove->userid, 'forum', $remove->forumid);
echo '.';
}
$db->debug = true;
rs_close($rs);
}
}
return $result; return $result;
} }
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
$postid = optional_param('postid', 0, PARAM_INT); // Used for tracking read posts if user initiated. $postid = optional_param('postid', 0, PARAM_INT); // Used for tracking read posts if user initiated.
if (!$discussion = get_record('forum_discussions', 'id', $d)) { if (!$discussion = get_record('forum_discussions', 'id', $d)) {
print_error("Discussion ID was incorrect or no longer exists"); error("Discussion ID was incorrect or no longer exists");
} }
if (!$course = get_record('course', 'id', $discussion->course)) { if (!$course = get_record('course', 'id', $discussion->course)) {
print_error("Course ID is incorrect - discussion is faulty"); error("Course ID is incorrect - discussion is faulty");
} }
if (!$forum = get_record('forum', 'id', $discussion->forum)) { if (!$forum = get_record('forum', 'id', $discussion->forum)) {
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
} }
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) { if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
print_error('Course Module ID was incorrect'); error('Course Module ID was incorrect');
} }
require_course_login($course, true, $cm); require_course_login($course, true, $cm);
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
if (!($USER->id == $discussion->userid || (($discussion->timestart == 0 if (!($USER->id == $discussion->userid || (($discussion->timestart == 0
|| $discussion->timestart <= time()) || $discussion->timestart <= time())
&& ($discussion->timeend == 0 || $discussion->timeend > time())))) { && ($discussion->timeend == 0 || $discussion->timeend > time())))) {
print_error('Discussion ID was incorrect or no longer exists', '', "$CFG->wwwroot/mod/forum/view.php?f=$forum->id"); error('Discussion ID was incorrect or no longer exists', "$CFG->wwwroot/mod/forum/view.php?f=$forum->id");
} }
} }
...@@ -49,25 +49,26 @@ ...@@ -49,25 +49,26 @@
require_capability('mod/forum:movediscussions', $modcontext); require_capability('mod/forum:movediscussions', $modcontext);
if ($forum->type == 'single') { if ($forum->type == 'single') {
print_error('Cannot move discussion from a simple single discussion forum', '', $return); error('Cannot move discussion from a simple single discussion forum', $return);
} }
if (!$forumto = get_record('forum', 'id', $move)) { if (!$forumto = get_record('forum', 'id', $move)) {
print_error('You can\'t move to that forum - it doesn\'t exist!', '', $return); error('You can\'t move to that forum - it doesn\'t exist!', $return);
} }
if (!$cmto = get_coursemodule_from_instance('forum', $forumto->id, $course->id)) { if (!$cmto = get_coursemodule_from_instance('forum', $forumto->id, $course->id)) {
print_error('Target forum not found in this course.', '', $return); error('Target forum not found in this course.', $return);
} }
if (!coursemodule_visible_for_user($cmto)) { if (!coursemodule_visible_for_user($cmto)) {
print_error('Forum not visible', '', $return); error('Forum not visible', $return);
} }
if (!forum_move_attachments($discussion, $forumto->id)) { if (!forum_move_attachments($discussion, $forumto->id)) {
notify("Errors occurred while moving attachment directories - check your file permissions"); notify("Errors occurred while moving attachment directories - check your file permissions");
} }
set_field('forum_discussions', 'forum', $forumto->id, 'id', $discussion->id); set_field('forum_discussions', 'forum', $forumto->id, 'id', $discussion->id);
set_field('forum_read', 'forumid', $forumto->id, 'discussionid', $discussion->id);
add_to_log($course->id, 'forum', 'move discussion', "discuss.php?d=$discussion->id", $discussion->id, $cmto->id); add_to_log($course->id, 'forum', 'move discussion', "discuss.php?d=$discussion->id", $discussion->id, $cmto->id);
require_once($CFG->libdir.'/rsslib.php'); require_once($CFG->libdir.'/rsslib.php');
...@@ -77,8 +78,8 @@ ...@@ -77,8 +78,8 @@
// the regeneration of the feeds since the discussions have been // the regeneration of the feeds since the discussions have been
// moved. // moved.
if (!forum_rss_delete_file($forum) || !forum_rss_delete_file($forumto)) { if (!forum_rss_delete_file($forum) || !forum_rss_delete_file($forumto)) {
print_error('Could not purge the cached RSS feeds for the source and/or'. error('Could not purge the cached RSS feeds for the source and/or'.
'destination forum(s) - check your file permissionsforums', '', $return); 'destination forum(s) - check your file permissionsforums', $return);
} }
redirect($return.'&amp;moved=-1&amp;sesskey='.sesskey()); redirect($return.'&amp;moved=-1&amp;sesskey='.sesskey());
...@@ -109,19 +110,18 @@ ...@@ -109,19 +110,18 @@
} }
if (! $post = forum_get_post_full($parent)) { if (! $post = forum_get_post_full($parent)) {
print_error("Discussion no longer exists", '', "$CFG->wwwroot/mod/forum/view.php?f=$forum->id"); error("Discussion no longer exists", "$CFG->wwwroot/mod/forum/view.php?f=$forum->id");
} }
if (!forum_user_can_view_post($post, $course, $cm, $forum, $discussion)) { if (!forum_user_can_view_post($post, $course, $cm, $forum, $discussion)) {
print_error('You do not have permissions to view this post', '', "$CFG->wwwroot/mod/forum/view.php?id=$forum->id"); error('You do not have permissions to view this post', "$CFG->wwwroot/mod/forum/view.php?id=$forum->id");
} }
if ($mark == 'read' or $mark == 'unread') { if ($mark == 'read' or $mark == 'unread') {
if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum) && if ($CFG->forum_usermarksread && forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
$CFG->forum_usermarksread) {
if ($mark == 'read') { if ($mark == 'read') {
forum_tp_add_read_record($USER->id, $postid, $discussion->id, $forum->id); forum_tp_add_read_record($USER->id, $postid);
} else { } else {
// unread // unread
forum_tp_delete_read_records($USER->id, $postid); forum_tp_delete_read_records($USER->id, $postid);
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
if ($id) { if ($id) {
if (! $course = get_record('course', 'id', $id)) { if (! $course = get_record('course', 'id', $id)) {
print_error("Course ID is incorrect"); error("Course ID is incorrect");
} }
} else { } else {
if (! $course = get_site()) { if (! $course = get_site()) {
print_error("Could not find a top-level course!"); error("Could not find a top-level course!");
} }
} }
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
$generaltable->head = array ($strforum, $strdescription, $strdiscussions); $generaltable->head = array ($strforum, $strdescription, $strdiscussions);
$generaltable->align = array ('left', 'left', 'center'); $generaltable->align = array ('left', 'left', 'center');
if ($usetracking = (!isguestuser() && forum_tp_can_track_forums())) { if ($usetracking = forum_tp_can_track_forums()) {
$untracked = forum_tp_get_untracked_forums($USER->id, $course->id); $untracked = forum_tp_get_untracked_forums($USER->id, $course->id);
$generaltable->head[] = $strunreadposts; $generaltable->head[] = $strunreadposts;
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
$generaltable->align[] = 'center'; $generaltable->align[] = 'center';
} }
$subscribed_forums = forum_get_subscribed_forums($course);
if ($can_subscribe = (!isguestuser() && has_capability('moodle/course:view', $coursecontext))) { if ($can_subscribe = (!isguestuser() && has_capability('moodle/course:view', $coursecontext))) {
$generaltable->head[] = $strsubscribed; $generaltable->head[] = $strsubscribed;
$generaltable->align[] = 'center'; $generaltable->align[] = 'center';
...@@ -118,11 +120,12 @@ ...@@ -118,11 +120,12 @@
/// Do course wide subscribe/unsubscribe /// Do course wide subscribe/unsubscribe
if (!is_null($subscribe) and !isguestuser() and !isguest()) { if (!is_null($subscribe) and !isguestuser() and !isguest()) {
foreach ($modinfo->instances['forum'] as $forumid=>$cm) { foreach ($modinfo->instances['forum'] as $forumid=>$cm) {
if (!forum_is_forcesubscribed($forumid)) { $forum = $forums[$forumid];
$subscribed = forum_is_subscribed($USER->id, $forumid); if (!forum_is_forcesubscribed($forum)) {
$subscribed = forum_is_subscribed($USER->id, $forum);
if ($subscribe && !$subscribed) { if ($subscribe && !$subscribed) {
forum_subscribe($USER->id, $forumid); forum_subscribe($USER->id, $forumid);
} elseif (!$subscribe && $subscribed) { } else if (!$subscribe && $subscribed) {
forum_unsubscribe($USER->id, $forumid); forum_unsubscribe($USER->id, $forumid);
} }
} }
...@@ -147,70 +150,48 @@ ...@@ -147,70 +150,48 @@
$cm = $modinfo->instances['forum'][$forum->id]; $cm = $modinfo->instances['forum'][$forum->id];
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id);
$groupmode = groups_get_activity_groupmode($cm, $course); $count = forum_count_discussions($forum, $cm, $course);
$currentgroup = groups_get_activity_group($cm);
if ($groupmode == SEPARATEGROUPS) {
$accessallgroups = has_capability('moodle/site:accessallgroups', $context);
} else {
$accessallgroups = true;
}
$cantaccessagroup = !$accessallgroups and empty($currentgroup);
// this is potentially wrong logic. could possibly check for if user has the right to hmmm
if ($cantaccessagroup) {
$count = '';
} if ($currentgroup) {
$count = count_records_select('forum_discussions', "forum = $forum->id AND (groupid = $currentgroup OR groupid = -1)");
} else {
$count = count_records('forum_discussions', 'forum', $forum->id);
}
if ($usetracking) { if ($usetracking) {
if ($forum->trackingtype == FORUM_TRACKING_OFF) { if ($forum->trackingtype == FORUM_TRACKING_OFF) {
$unreadlink = '-'; $unreadlink = '-';
$trackedlink = '-'; $trackedlink = '-';
} else if (($forum->trackingtype == FORUM_TRACKING_ON) || !isset($untracked[$forum->id])) {
$groupid = !$accessallgroups ? $currentgroup : false; } else {
$unread = forum_tp_count_forum_unread_posts($USER->id, $forum->id, $groupid); if (isset($untracked[$forum->id])) {
if ($unread > 0) { $unreadlink = '-';
$unreadlink = '<span class="unread"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>'; } 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 .= '<a title="'.$strmarkallread.'" href="markposts.php?f='. $unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?f='.
$forum->id.'&amp;mark=read"><img src="'.$CFG->pixpath.'/t/clear.gif" alt="'.$strmarkallread.'" /></a></span>'; $forum->id.'&amp;mark=read"><img src="'.$CFG->pixpath.'/t/clear.gif" alt="'.$strmarkallread.'" /></a></span>';
} else { } else {
$unreadlink = '<span class="read"><a href="view.php?f='.$forum->id.'">'.$unread.'</a></span>'; $unreadlink = '<span class="read">0</span>';
} }
if ($forum->trackingtype == FORUM_TRACKING_ON) {
$trackedlink = $stryes;
if ($forum->trackingtype == FORUM_TRACKING_OPTIONAL) {
$trackedlink = print_single_button($CFG->wwwroot . '/mod/forum/settracking.php?id=' . $forum->id, '', $stryes, 'post', '_self', true, $strnotrackforum);
} else { } else {
$trackedlink = $stryes; $options = array('id'=>$forum->id);
if (!isset($untracked[$forum->id])) {
$trackedlink = print_single_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $stryes, 'post', '_self', true, $strnotrackforum);
} else {
$trackedlink = print_single_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $strno, 'post', '_self', true, $strtrackforum);
}
} }
} else {
$unreadlink = '-';
$trackedlink = print_single_button($CFG->wwwroot . '/mod/forum/settracking.php?id=' . $forum->id, '', $strno, 'post', '_self', true, $strtrackforum);
} }
} }
$forum->intro = shorten_text(trim(format_text($forum->intro, FORMAT_HTML, $introoptions)), $CFG->forum_shortpost); $forum->intro = shorten_text(trim(format_text($forum->intro, FORMAT_HTML, $introoptions)), $CFG->forum_shortpost);
$forumname = format_string($forum->name, true);; $forumname = format_string($forum->name, true);;
if ($cantaccessagroup) { if ($cm->visible) {
$forumlink = $forumname; $style = '';
$discussionlink = $count;
} else { } else {
if ($cm->visible) { $style = 'class="dimmed"';
$style = '';
} else {
$style = 'class="dimmed"';
}
$forumlink = "<a href=\"view.php?f=$forum->id\" $style>".format_string($forum->name,true)."</a>";
$discussionlink = "<a href=\"view.php?f=$forum->id\" $style>".$count."</a>";
} }
$forumlink = "<a href=\"view.php?f=$forum->id\" $style>".format_string($forum->name,true)."</a>";
$discussionlink = "<a href=\"view.php?f=$forum->id\" $style>".$count."</a>";
$row = array ($forumlink, $forum->intro, $discussionlink); $row = array ($forumlink, $forum->intro, $discussionlink);
if ($usetracking) { if ($usetracking) {
...@@ -219,21 +200,29 @@ ...@@ -219,21 +200,29 @@
} }
if ($can_subscribe) { if ($can_subscribe) {
$row[] = forum_get_subscribe_link($forum, $context, array('subscribed' => $stryes, if ($forum->forcesubscribe != FORUM_DISALLOWSUBSCRIBE) {
'unsubscribed' => $strno, 'forcesubscribed' => $stryes, $row[] = forum_get_subscribe_link($forum, $context, array('subscribed' => $stryes,
'cantsubscribe' => '-'), $cantaccessagroup, false, true); 'unsubscribed' => $strno, 'forcesubscribed' => $stryes,
'cantsubscribe' => '-'), false, false, true, $subscribed_forums);
} else {
$row[] = '-';
}
} }
//If this forum has RSS activated, calculate it //If this forum has RSS activated, calculate it
if ($show_rss and $forum->rsstype and $forum->rssarticles) { if ($show_rss) {
//Calculate the tolltip text if ($forum->rsstype and $forum->rssarticles) {
if ($forum->rsstype == 1) { //Calculate the tolltip text
$tooltiptext = get_string('rsssubscriberssdiscussions', 'forum', format_string($forum->name)); if ($forum->rsstype == 1) {
$tooltiptext = get_string('rsssubscriberssdiscussions', 'forum', format_string($forum->name));
} else {
$tooltiptext = get_string('rsssubscriberssposts', 'forum', format_string($forum->name));
}
//Get html code for RSS link
$row[] = rss_get_link($course->id, $USER->id, 'forum', $forum->id, $tooltiptext);
} else { } else {
$tooltiptext = get_string('rsssubscriberssposts', 'forum', format_string($forum->name)); $row[] = '&nbsp;';
} }
//Get html code for RSS link
$row[] = rss_get_link($course->id, $USER->id, 'forum', $forum->id, $tooltiptext);
} }
$generaltable->data[] = $row; $generaltable->data[] = $row;
...@@ -283,51 +272,35 @@ ...@@ -283,51 +272,35 @@
$cm = $modinfo->instances['forum'][$forum->id]; $cm = $modinfo->instances['forum'][$forum->id];
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id);
$groupmode = groups_get_activity_groupmode($cm, $course); $count = forum_count_discussions($forum, $cm, $course);
$currentgroup = groups_get_activity_group($cm);
if ($groupmode == SEPARATEGROUPS) {
$accessallgroups = has_capability('moodle/site:accessallgroups', $context);
} else {
$accessallgroups = true;
}
$cantaccessagroup = !$accessallgroups and empty($currentgroup);
if ($cantaccessagroup) {
$count = '';
} if ($currentgroup) {
$count = count_records_select('forum_discussions', "forum = $forum->id AND (groupid = $currentgroup OR groupid = -1)");
} else {
$count = count_records('forum_discussions', 'forum', $forum->id);
}
if ($usetracking) { if ($usetracking) {
if ($forum->trackingtype == FORUM_TRACKING_OFF) { if ($forum->trackingtype == FORUM_TRACKING_OFF) {
$unreadlink = '-'; $unreadlink = '-';
$trackedlink = '-'; $trackedlink = '-';
} else if (($forum->trackingtype == FORUM_TRACKING_ON) || } else {
!isset($untracked[$forum->id])) { if (isset($untracked[$forum->id])) {
$groupid = !$accessallgroups ? $currentgroup : false; $unreadlink = '-';
$unread = forum_tp_count_forum_unread_posts($USER->id, $forum->id, $groupid); } else if ($unread = forum_tp_count_forum_unread_posts($cm, $course)) {
if ($unread > 0) {
$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.'</a>';
$unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?f='. $unreadlink .= '<a title="'.$strmarkallread.'" href="markposts.php?f='.
$forum->id.'&amp;mark=read"><img src="'.$CFG->pixpath.'/t/clear.gif" alt="'.$strmarkallread.'" /></a></span>'; $forum->id.'&amp;mark=read"><img src="'.$CFG->pixpath.'/t/clear.gif" alt="'.$strmarkallread.'" /></a></span>';
} else { } else {
$unreadlink = '<span class="read"><a href="view.php?f='.$forum->id.'">'.$unread.'</a></span>'; $unreadlink = '<span class="read">0</span>';
} }
if ($forum->trackingtype == FORUM_TRACKING_OPTIONAL) {
$trackedlink = print_single_button($CFG->wwwroot . '/mod/forum/settracking.php?id=' . $forum->id, '', $stryes, 'post', '_self', true, $strnotrackforum); if ($forum->trackingtype == FORUM_TRACKING_ON) {
} else {
$trackedlink = $stryes; $trackedlink = $stryes;
} else {
$options = array('id'=>$forum->id);
if (!isset($untracked[$forum->id])) {
$trackedlink = print_single_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $stryes, 'post', '_self', true, $strnotrackforum);
} else {
$trackedlink = print_single_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $strno, 'post', '_self', true, $strtrackforum);
}
} }
} else {
$unreadlink = '-';
$trackedlink = print_single_button($CFG->wwwroot . '/mod/forum/settracking.php?id=' . $forum->id, '', $strno, 'post', '_self', true, $strtrackforum);
} }
} }
...@@ -345,18 +318,14 @@ ...@@ -345,18 +318,14 @@
} }
$forumname = format_string($forum->name,true);; $forumname = format_string($forum->name,true);;
if ($cantaccessagroup) {
$forumlink = $forumname; if ($cm->visible) {
$discussionlink = $count; $style = '';
} else { } else {
if ($cm->visible) { $style = 'class="dimmed"';
$style = '';
} else {
$style = 'class="dimmed"';
}
$forumlink = "<a href=\"view.php?f=$forum->id\" $style>".format_string($forum->name,true)."</a>";
$discussionlink = "<a href=\"view.php?f=$forum->id\" $style>".$count."</a>";
} }
$forumlink = "<a href=\"view.php?f=$forum->id\" $style>".format_string($forum->name,true)."</a>";
$discussionlink = "<a href=\"view.php?f=$forum->id\" $style>".$count."</a>";