Permalink
Browse files

Added tracking settings per forum.

  • Loading branch information...
mchurch
mchurch committed Apr 26, 2005
1 parent e2c84c6 commit eaf50aeff888ee7a2e0e1b87cae025f0d6c9171e
Showing with 211 additions and 70 deletions.
  1. +4 −0 mod/forum/db/mysql.php
  2. +2 −1 mod/forum/discuss.php
  3. +16 −8 mod/forum/index.php
  4. +169 −56 mod/forum/lib.php
  5. +15 −0 mod/forum/mod.html
  6. +2 −2 mod/forum/post.php
  7. +1 −1 mod/forum/version.php
  8. +2 −2 mod/forum/view.php
View
@@ -201,6 +201,10 @@ function forum_upgrade($oldversion) {
) COMMENT=\'Tracks each users untracked forums.\';');
}
+ if ($oldversion < 2005042500) {
+ modify_database('','ALTER TABLE prefix_forum ADD `trackingtype` TINYINT(2) UNSIGNED DEFAULT \'2\' NOT NULL AFTER `forcesubscribe`;');
+ }
+
return true;
View
@@ -95,7 +95,8 @@
error("Discussion no longer exists", "$CFG->wwwroot/mod/forum/view.php?f=$forum->id");
}
- if ($CFG->forum_trackreadposts && $CFG->forum_usermarksread) {
+ if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum) &&
+ $CFG->forum_usermarksread) {
if ($mark == 'read') {
forum_tp_add_read_record($USER->id, $postid, $discussion->id, $forum->id);
} else if ($mark == 'unread') {
View
@@ -49,7 +49,7 @@
$generaltable->align = array ('left', 'left', 'center');
if ($usetracking = forum_tp_can_track_forums()) {
- $untracked = forum_tp_get_untracked_forums($USER->id);
+ $untracked = forum_tp_get_untracked_forums($USER->id, $course->id);
$generaltable->head[] = $strunreadposts;
$generaltable->align[] = 'center';
@@ -139,8 +139,8 @@
$count = count_records("forum_discussions", "forum", "$forum->id");
}
- if (forum_tp_can_track_forums()) {
- if (forum_tp_is_tracked($forum->id) && !isset($untracked[$forum->id])) {
+ if ($usetracking) {
+ if (($forum->trackingtype == FORUM_TRACKING_ON) || !isset($untracked[$forum->id])) {
$groupid = ($groupmode==SEPARATEGROUPS && !isteacheredit($course->id)) ? $currentgroup : false;
$unread = forum_tp_count_forum_unread_posts($USER->id, $forum->id, $groupid);
if ($unread > 0) {
@@ -150,10 +150,14 @@
} else {
$unreadlink = '<span class="read"><a href="view.php?f='.$forum->id.'">'.$unread.'</a>';
}
- $trackedlink = '<a title="'.$strnotrackforum.'" href="settracking.php?id='.$forum->id.'">'.$stryes.'</a>';
+ if ($forum->trackingtype == FORUM_TRACKING_OPTIONAL) {
+ $trackedlink = '<a title="'.$strnotrackforum.'" href="settracking.php?id='.
+ $forum->id.'">'.$stryes.'</a>';
+ }
} else {
$unreadlink = '-';
- $trackedlink = '<a title="'.$strtrackforum.'" href="settracking.php?id='.$forum->id.'">'.$strno.'</a>';
+ $trackedlink = '<a title="'.$strtrackforum.'" href="settracking.php?id='.
+ $forum->id.'">'.$strno.'</a>';
}
}
@@ -275,8 +279,9 @@
$count = count_records("forum_discussions", "forum", "$forum->id");
}
- if (forum_tp_can_track_forums()) {
- if (!isset($untracked[$forum->id])) {
+ if ($usetracking) {
+ if (($forum->trackingtype == FORUM_TRACKING_ON) ||
+ !isset($untracked[$forum->id])) {
$groupid = ($groupmode==SEPARATEGROUPS && !isteacheredit($course->id)) ? $currentgroup : false;
$unread = forum_tp_count_forum_unread_posts($USER->id, $forum->id, $groupid);
if ($unread > 0) {
@@ -286,7 +291,10 @@
} else {
$unreadlink = '<span class="read"><a href="view.php?f='.$forum->id.'">'.$unread.'</a></span>';
}
- $trackedlink = '<a title="'.$strnotrackforum.'" href="settracking.php?id='.$forum->id.'">'.$stryes.'</a>';
+ if ($forum->trackingtype == FORUM_TRACKING_OPTIONAL) {
+ $trackedlink = '<a title="'.$strnotrackforum.'" href="settracking.php?id='.
+ $forum->id.'">'.$stryes.'</a>';
+ }
} else {
$unreadlink = '-';
$trackedlink = '<a title="'.$strtrackforum.'" href="settracking.php?id='.$forum->id.'">'.$strno.'</a>';
Oops, something went wrong.

0 comments on commit eaf50ae

Please sign in to comment.