--- \\Ninjapanda\webvcr\drupal-4.6.0\modules\forum.module Sun Jun 12 18:28:39 2005
+++ \\Ninjapanda\webvcr\modules\forum.module Sun Jun 12 18:36:47 2005
@@ -794,7 +794,14 @@
else {
$output .= '
'. t('Login to post a new forum topic.', array('%login' => url('user/login'))) .'';
}
- $output .= '';
+ if ($user && $user->uid) {
+ if (!$tid) {
+ $output .= ''. l(t('Mark all content read.'), "node/readall") .'';
+ } else {
+ $output .= ''. l(t('Mark this forum read.'), "node/readall/$tid") .'';
+ }
+ }
+ $output .= '
';
$output .= theme('forum_list', $forums, $parents, $tid);
--- \\Ninjapanda\webvcr\drupal-4.6.0\modules\node.module Sun Jun 12 18:28:39 2005
+++ \\Ninjapanda\webvcr\modules\node.module Sun Jun 12 18:37:44 2005
@@ -687,6 +687,10 @@
'access' => user_access('access content'),
'type' => MENU_ITEM_GROUPING,
'weight' => 1);
+ $items[] = array('path' => 'node/readall', 'title' => t('mark all content read'),
+ 'callback' => 'node_mark_all_read',
+ 'access' => user_access('access content'),
+ 'type' => MENU_CALLBACK);
}
else {
if (arg(0) == 'node' && is_numeric(arg(1))) {
@@ -1985,5 +1989,19 @@
/**
* @} End of "defgroup node_access".
*/
+
+function node_mark_all_read($tid = 0) {
+ global $user;
+ if ($user && $user->uid) {
+ if (is_numeric($tid) && $tid) {
+ db_query("REPLACE INTO {history} (uid,nid,timestamp) SELECT '%d',n.nid,UNIX_TIMESTAMP() from {node} n INNER JOIN {term_node} r ON n.nid=r.nid INNER JOIN {node_comment_statistics} l ON l.nid=n.nid WHERE (n.created > '%d' OR l.last_comment_timestamp > '%d') AND r.tid='%d'", $user->uid,NODE_NEW_LIMIT,NODE_NEW_LIMIT,$tid);
+ drupal_goto("forum/$tid");
+ } else {
+ db_query("REPLACE INTO {history} (uid,nid,timestamp) SELECT '%d',n.nid,UNIX_TIMESTAMP() from {node} n INNER JOIN {node_comment_statistics} l ON l.nid=n.nid WHERE (n.created > '%d' OR l.last_comment_timestamp > '%d')", $user->uid,NODE_NEW_LIMIT,NODE_NEW_LIMIT);
+ drupal_goto("forum");
+ }
+ print theme('page',"All content has been marked read");
+ }
+}
?>