Changeset 1280 in ExiteCMS for trunk/forum/viewforum.php
- Timestamp:
- 02/14/08 15:02:48 (4 years ago)
- File:
-
- 1 edited
-
trunk/forum/viewforum.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/viewforum.php
r1278 r1280 66 66 } 67 67 68 // get the number of unread posts in this forum69 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false);70 $variables['unread_posts'] = ($result ? mysql_result($result, 0) : 0);71 72 68 // if a forum rules custompage is given, check if it exists 73 69 $variables['rulespage_defined'] = false; … … 107 103 } 108 104 109 // check forunread posts in this forum105 // get the number of unread posts in this forum 110 106 if (iMEMBER) { 111 $result = dbquery(" 112 SELECT count(*) as unread, sum(tr.thread_page) AS pages 113 FROM ".$db_prefix."posts p 114 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 115 WHERE tr.user_id = '".$userdata['user_id']."' 116 AND tr.forum_id = '".$forum_id."' 117 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 118 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 119 ", false); 120 $data['unread_count'] = ($result ? mysql_result($result, 0) : 0); 107 if ($userdata['user_posts_unread']) { 108 // include the users own posts 109 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 110 } else { 111 // filter the users own posts 112 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 113 } 114 $variables['unread_posts'] = ($result ? mysql_result($result, 0) : 0); 121 115 } else { 122 $ data['unread_count'] = 0;116 $variables['unread_posts'] = 0; 123 117 } 124 118
Note: See TracChangeset
for help on using the changeset viewer.
