Changeset 1307 in ExiteCMS for trunk/forum/viewforum.php
- Timestamp:
- 02/27/08 09:57:44 (4 years ago)
- File:
-
- 1 edited
-
trunk/forum/viewforum.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/viewforum.php
r1280 r1307 107 107 if ($userdata['user_posts_unread']) { 108 108 // include the users own posts 109 $result = dbquery("SELECT count(*) as unread , sum(tr.thread_page) AS pagesFROM ".$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);109 $result = dbquery("SELECT count(*) as unread 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 110 } else { 111 111 // filter the users own posts 112 $result = dbquery("SELECT count(*) as unread , sum(tr.thread_page) AS pagesFROM ".$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);112 $result = dbquery("SELECT count(*) as unread 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 113 } 114 114 $variables['unread_posts'] = ($result ? mysql_result($result, 0) : 0); … … 152 152 if (isset($userdata['user_id']) && $variables['unread_posts']) { 153 153 $result2 = dbquery(" 154 SELECT count(*) as unread, sum(tr.thread_page) AS pages,MIN(p.post_id) as post_id154 SELECT count(*) as unread, MIN(p.post_id) as post_id 155 155 FROM ".$db_prefix."posts p 156 156 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id … … 173 173 $data['first_unread_post'] = 0; 174 174 } 175 // number of pages of posts in this thread176 $data['thread_pages'] = ceil($data['thread_replies'] / $settings['numofthreads']) + 1;177 175 // correct the number of replies 178 176 $data['thread_replies'] = max(0, $data['thread_replies'] - 1);
Note: See TracChangeset
for help on using the changeset viewer.
