Changeset 1312 in ExiteCMS


Ignore:
Timestamp:
02/27/08 11:28:54 (4 years ago)
Author:
hverton
Message:

added the new thread_first_read field to the posts unread queries in the pli-images.org themes, to get a more accurante unread posts number

Location:
themes/PLi-Fusion
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • themes/PLi-Fusion/PLiTheme/php-files/themes/PLiTheme/theme.php

    r1307 r1312  
    8383// unread forum post indicator 
    8484if (iMEMBER && $settings['revision'] >= 1193) { 
    85     $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 (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); 
     85    if ($userdata['user_posts_unread']) { 
     86        $result = dbquery(" 
     87            SELECT count(*) as unread  
     88                FROM ".$db_prefix."posts p  
     89                    LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     90                WHERE tr.user_id = '".$userdata['user_id']."'  
     91                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
     92                    AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     93                        OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 
     94            ); 
     95    } else { 
     96        $result = dbquery(" 
     97            SELECT count(*) as unread  
     98                FROM ".$db_prefix."posts p  
     99                    LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     100                WHERE tr.user_id = '".$userdata['user_id']."'  
     101                    AND p.post_author != '".$userdata['user_id']."' 
     102                    AND p.post_edituser != '".$userdata['user_id']."' 
     103                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
     104                    AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     105                        OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 
     106            ); 
     107    }  
    86108    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
    87109} else { 
  • themes/PLi-Fusion/PLiThemeCentered/php-files/themes/PLiThemeCentered/theme.php

    r1307 r1312  
    8383// unread forum post indicator 
    8484if (iMEMBER && $settings['revision'] >= 1193) { 
    85     $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 (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); 
     85    if ($userdata['user_posts_unread']) { 
     86        $result = dbquery(" 
     87            SELECT count(*) as unread  
     88                FROM ".$db_prefix."posts p  
     89                    LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     90                WHERE tr.user_id = '".$userdata['user_id']."'  
     91                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
     92                    AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     93                        OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 
     94            ); 
     95    } else { 
     96        $result = dbquery(" 
     97            SELECT count(*) as unread  
     98                FROM ".$db_prefix."posts p  
     99                    LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     100                WHERE tr.user_id = '".$userdata['user_id']."'  
     101                    AND p.post_author != '".$userdata['user_id']."' 
     102                    AND p.post_edituser != '".$userdata['user_id']."' 
     103                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
     104                    AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     105                        OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 
     106            ); 
     107    }  
    86108    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
    87109} else { 
  • themes/PLi-Fusion/PLiXmas/php-files/themes/PLiXmas/theme.php

    r1307 r1312  
    8383// unread forum post indicator 
    8484if (iMEMBER && $settings['revision'] >= 1193) { 
    85     $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 (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); 
     85    if ($userdata['user_posts_unread']) { 
     86        $result = dbquery(" 
     87            SELECT count(*) as unread  
     88                FROM ".$db_prefix."posts p  
     89                    LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     90                WHERE tr.user_id = '".$userdata['user_id']."'  
     91                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
     92                    AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     93                        OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 
     94            ); 
     95    } else { 
     96        $result = dbquery(" 
     97            SELECT count(*) as unread  
     98                FROM ".$db_prefix."posts p  
     99                    LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     100                WHERE tr.user_id = '".$userdata['user_id']."'  
     101                    AND p.post_author != '".$userdata['user_id']."' 
     102                    AND p.post_edituser != '".$userdata['user_id']."' 
     103                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
     104                    AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     105                        OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 
     106            ); 
     107    }  
    86108    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
    87109} else { 
Note: See TracChangeset for help on using the changeset viewer.