Changeset 1654 in ExiteCMS for trunk/forum/viewthread.php


Ignore:
Timestamp:
08/19/08 11:02:58 (4 years ago)
Author:
hverton
Message:

added a new forum setting to limit forum message visibility for guests to a set number of days. Older threads will not be accessable. This may encourage visitors to become a member

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/viewthread.php

    r1598 r1654  
    118118$variables['user_can_blacklist'] = checkrights("B"); 
    119119 
     120// check if there is a thread time limit defined for guests 
     121$thread_limit = iMEMBER ? 0 : (time() - $settings['forum_guest_limit'] * 86400); 
     122 
    120123// get information about the current thread 
    121124$result = dbquery( 
    122125    "SELECT * FROM ".$db_prefix."threads  
    123     WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'" 
     126    WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'".($thread_limit==0?"":" AND thread_lastpost > ".$thread_limit) 
    124127); 
    125 // bail out if the requested forum does not exist 
     128// bail out if the requested thread does not exist 
    126129if (!dbrows($result)) { 
    127     fallback("index.php"); 
    128 } 
     130    fallback("viewforum.php?forum_id=".$forum_id); 
     131} 
     132 
    129133// store the thread information 
    130134$tdata = dbarray($result); 
     
    342346        } else { 
    343347            // check if the post timestamp within the set unread threshold 
    344             if ($data['post_datestamp'] > $settings['unread_threshold'] || $data['post_editttime'] > $settings['unread_threshold']) { 
     348            if ($data['post_datestamp'] > $settings['unread_threshold'] || $data['post_edittime'] > $settings['unread_threshold']) { 
    345349                // check if it is newer that the first and last marker in the threads_read record 
    346350                if ($data['post_datestamp'] > $thread_last_read || $data['post_edittime'] > $thread_last_read || $data['post_datestamp'] < $thread_first_read || ($data['post_edittime'] != 0 && $data['post_edittime'] < $thread_first_read))  { 
     
    349353                    $data['unread'] = false; 
    350354                } 
     355            } else { 
     356                $data['unread'] = false; 
    351357            } 
    352358        } 
Note: See TracChangeset for help on using the changeset viewer.