Changeset 1280 in ExiteCMS for trunk/forum/index.php


Ignore:
Timestamp:
02/14/08 15:02:48 (4 years ago)
Author:
hverton
Message:

added user option to show/hide the users own posts from the unread posts count

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/index.php

    r1194 r1280  
    8080    // get the unread posts count for this forum 
    8181    if (iMEMBER) { 
    82         $result2 = 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 = '".$data['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); 
     82        if ($userdata['user_posts_unread']) { 
     83            // include the users own posts 
     84            $result2 = 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 = '".$data['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); 
     85        } else { 
     86            // filter the users own posts 
     87            $result2 = 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 = '".$data['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); 
     88        } 
    8389        $data['unread_posts'] = ($result2 ? mysql_result($result2, 0) : 0); 
    8490    } else { 
Note: See TracChangeset for help on using the changeset viewer.