Welcome guest, is this your first visit? Create Account now to join.
  • Login:

Members in Chat:
+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    mega's Avatar
    mega is offline Newbie Net Builder
    Join Date
    May 2009
    Location
    Hell , Wanna Come ??
    Posts
    62
    $NetBucks
    728
    Thanked 10 Times in 4 Posts

    Red face

    I am creating a script that lock topics post automatically.

    It is still writing and only finisehd the first part.
    And now will build the admin UI so that users could modify the settings
    in the acp.

    open viewforum.php
    [FIND]
    <a href="http://ipost2host.com/viewtopic.php?f=13&t=1583#" target="_blank">
    </a>
    Code:
        $template->assign_var(&#39;RUN_CRON_TASK&#39;, &#39;[img]&#39; . append_sid($phpbb_root_path . &#39;cron.&#39; . $phpEx, &#39;cron_type=prune_forum&amp;f=&#39; . $forum_id) . &#39;[/img]&#39;);
    }
    [AFTER ADD]
    <a href="http://ipost2host.com/viewtopic.php?f=13&t=1583#" target="_blank">
    </a>
    Code:
    // Auto lock the topics from forums
    $blr_config = array();
    $blr_config[&#39;topic_auto_lock&#39;] = true;
    $blr_config[&#39;topic_auto_lock_forums&#39;] = array(6);
    $blr_config[&#39;interval&#39;] = 7;
    $blr_interval = $blr_config[&#39;interval&#39;] * 24 * 3600;
    
    $sql = &#39;SELECT COUNT(topic_id) AS num_posts
        FROM &#39;. TOPICS_TABLE . 
        " WHERE forum_id = $forum_id
            AND topic_type = " . POST_NORMAL . " AND topic_status = 0 AND (topic_time + $blr_interval) < " . time();
    
    $result = $db->sql_query($sql);
    $blr_count = (int) $db->sql_fetchfield(&#39;num_posts&#39;);
    $db->sql_freeresult($result);
    
    $lock_topics = in_array($forum_id, $blr_config[&#39;topic_auto_lock_forums&#39;]);
    
    if ($blr_count && $lock_topics)
    {
        $sql = &#39;UPDATE &#39; . TOPICS_TABLE .
            " SET topic_status = 1 
                WHERE forum_id = $forum_id
                    AND topic_type = " . POST_NORMAL . " AND topic_status = 0 AND (topic_time + $blr_interval) < " . time();
    
        $db->sql_query($sql);
    }
    Enjoy and comments are welcome
    I&#39;am update this when it finished.
    Never argue with an idiot; First he takes you down to his level and then he beats you with experience.


 

Similar Threads

  1. [phpBB] - Happy 10th Birthday phpBB!
    By StephenM in forum Community Software
    Replies: 0
    Last Post: 18 June, 2010, 02:57 AM
  2. [WTS] 100% auto Watch Movies/Tv show Script
    By drunk in forum Scripts
    Replies: 0
    Last Post: 19 February, 2010, 01:13 AM
  3. Replies: 1
    Last Post: 18 May, 2009, 20:32 PM
  4. Replies: 9
    Last Post: 15 May, 2009, 20:59 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts