Changeset 1307 in ExiteCMS for trunk/forum/viewforum.php


Ignore:
Timestamp:
02/27/08 09:57:44 (4 years ago)
Author:
root
Message:

removed the thread_page field from the threads_read table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/viewforum.php

    r1280 r1307  
    107107    if ($userdata['user_posts_unread']) { 
    108108        // 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); 
     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); 
    110110    } else { 
    111111        // 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); 
     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); 
    113113    } 
    114114    $variables['unread_posts'] = ($result ? mysql_result($result, 0) : 0); 
     
    152152    if (isset($userdata['user_id']) && $variables['unread_posts']) { 
    153153        $result2 = dbquery(" 
    154             SELECT count(*) as unread, sum(tr.thread_page) AS pages, MIN(p.post_id) as post_id 
     154            SELECT count(*) as unread, MIN(p.post_id) as post_id 
    155155                FROM ".$db_prefix."posts p  
    156156                LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     
    173173        $data['first_unread_post'] = 0; 
    174174    } 
    175     // number of pages of posts in this thread 
    176     $data['thread_pages'] = ceil($data['thread_replies'] / $settings['numofthreads']) + 1; 
    177175    // correct the number of replies 
    178176    $data['thread_replies'] = max(0, $data['thread_replies'] - 1); 
Note: See TracChangeset for help on using the changeset viewer.