Changeset 1654 in ExiteCMS for trunk/forum/viewposts.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/viewposts.php

    r1405 r1654  
    3131if (!isset($forum_id) || !isNum($forum_id)) $forum_id = false; 
    3232 
     33// is a thread time limit defined for guest users? 
     34$thread_limit = iMEMBER ? 0 : (time() - $settings['forum_guest_limit'] * 86400); 
     35 
    3336// check if we have anything to display 
    3437$result = dbquery( 
    3538    "SELECT tp.*, tf.* FROM ".$db_prefix."posts tp 
     39    INNER JOIN ".$db_prefix."threads th USING(thread_id) 
    3640    INNER JOIN ".$db_prefix."forums tf USING(forum_id) 
    37     WHERE ".groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "") 
     41    WHERE ".($thread_limit==0?"":" th.thread_lastpost > ".$thread_limit." AND ").groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "") 
    3842); 
     43 
    3944$rows = dbrows($result); 
    4045$variables['rows'] = $rows; 
     
    4651$result = dbquery( 
    4752    "SELECT tp.*, tf.* FROM ".$db_prefix."posts tp 
     53    INNER JOIN ".$db_prefix."threads th USING(thread_id) 
    4854    INNER JOIN ".$db_prefix."forums tf USING(forum_id) 
    49     WHERE ".groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "")." 
     55    WHERE ".($thread_limit==0?"":" th.thread_lastpost > ".$thread_limit." AND ").groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "")." 
    5056    ORDER BY post_datestamp DESC  
    5157    LIMIT $rowstart,".ITEMS_PER_PAGE 
Note: See TracChangeset for help on using the changeset viewer.