Modification Name: Forum Based Minimal Posts Needed

Description: This modification will add three options to your Forum Options.
                   There you can set a minimal postcount that's needed to :
                   - create new threads in a forum,
                   - create replies to threads in a forum,
                   - enter a forum and view its threads.
                   It will also add a 'block' at the top of the threadlist and thread mentioning the amount of posts needed, if there are any needed.
                   These limitations do not count for (Super) Administrators.

Compatibilty:   1.9.8 Final SP3/SP4

Version: 1.8

Code Designed By: FunForum
Updated By: JDaniels
Updated for 1.9.8 SP3/SP4 by: WormHole @ XMB Garage

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Notes:
        * For your own safety, backup the effected PHP files and templates before proceeding with the installation of this modification.
        * Please select ALL coding when you do a Copy/Paste.

Version History:

        * 2004 / 09 / 29 : Adjusted coding to adapt to the newest build,
        * 2004 / 10 / 28 : Adjusted coding to the "XMB 1.9.1 Final - Nexus" coding.
        * 2007 / 01 / 22 : Adjusted coding to the "XMB 1.9.6 - Nexus" coding, added 'Search' support. Can't believe I started this in 2004 and it's already 2007 ...
        * 2007 / 04 / 08 : Adjusted coding to the "XMB 1.9.7 - Nexus" coding, added option for index.php to hide forums for people that don't have access to them. Maybe an idea to create a "Introduce Yourself" forum and set the access for all forums but that one to 1.
        * 2007 / 12 / 14 : Updated for 1.9.8 Final
        * 2007 / 12 / 14 : Updated for 1.9.8 Final SP2
        * 2008 / 03 / 01 : Fixed bug concerning printable version.
        * 2008 / 04 / 21 : Fixed step for today.php
        * 2008 / 12 / 20 : Updated for 1.9.8 Final SP3
        * 2009 / 08 / 23 : Updated for 1.9.8 Final SP4

=============================================================================================================================
=======
Step 1:
=======
===============================
Administration Panel --> Insert Raw SQL
===============================
========================================
Copy Code And Paste Into Textbox And Click Submit
========================================

ALTER TABLE $table_forums ADD mpnt int(6) NOT NULL default '0';
ALTER TABLE $table_forums ADD mpnp int(6) NOT NULL default '0';
ALTER TABLE $table_forums ADD mpfa int(6) NOT NULL default '0';

==============================================================================================================================
=======
Step 2:
=======
=======================
Edit File: /lang/English.lang.php
=======================
============================
Add Code To End Of File Above ?>
============================

// Forum Based Minimal Posts Needed Mod Begin
$lang['mpnp'] = "Minimal amount of posts needed before a <strong>reply</strong> can be made in this forum:<br />If set to 0 then there is no minimum.";
$lang['mpnt'] = "Minimal amount of posts needed before a <strong>new thread</strong> can be started in this forum:<br />If set to 0 then there is no minimum.";
$lang['mpfa'] = "Minimal amount of posts needed before a person can <strong>enter this forum</strong> and view its threads:<br />If set to 0 then there is no minimum.";
$lang['mpnpe'] = "Sorry, you do not have enough posts to reply in this forum.<br />You need at least *posts* post(s) to be able to reply in this forum.";
$lang['mpnte'] = "Sorry, you do not have enough posts to start a thread in this forum.<br />You need at least *posts* post(s) to be able to start a thread in this forum.";
$lang['mpfae'] = "Sorry, you do not have enough posts to view this forum and its threads.<br />You need at least *posts* post(s) to be able to view this forum and it's content.";
$lang['mpnpi'] = " &raquo; You need at least *posts* post(s) to be able to reply in this forum.";
$lang['mpnti'] = " &raquo; You need at least *posts* post(s) to be able to start a thread in this forum.";
$lang['mpfai'] = " &raquo; You need at least *posts* post(s) to be able to view this forum and its threads.";
$lang['mpfi'] = "Forum Information";
$lang['text_nothingtosearch'] = 'nothing to search for...';
// Forum Based Minimal Posts Needed Mod End

=============================================================================================================================
=======
Step 3:
=======
==============================
Create Template: forumdisplay_mpn_info
==============================
=======================
Add Code And Click Submit:
=======================

<table cellspacing="0" cellpadding="0" border="0" width="$THEME[tablewidth]" align="center">
<tr><td bgcolor="$THEME[bordercolor]">
<table border="0" cellspacing="$THEME[borderwidth]" cellpadding="$THEME[tablespace]" width="100%">
<tr><td class="category"><font color="$THEME[cattext]"><strong>$lang[mpfi]</strong></font></td></tr>
<tr class="tablerow" bgcolor="$THEME[altbg2]"><td align="left">$showfi</td></tr>
</table>
</td></tr></table>
<br />

==============================================================================================================================
=======
Step 4:
=======
======================================
Edit Templates: forumdisplay & forumdisplay_admin
======================================
==============
Find (at the top):
==============

$subforums

===========
Add Below:
===========

$minimal_posts_needed

=============================================================================================================================
=======
Step 5:
=======
====================
Edit Template: viewthread
====================
==============
Find (at the top):
==============

$poll

===========
Add Above:
===========

$minimal_posts_needed

=============================================================================================================================
=======
Step 6:
=======
==============
Edit File: cp.php
==============
======
Find:
======

        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textuserlist']?></td>
        <td bgcolor="<?php echo $altbg2?>"><textarea rows="4" cols="30" name="userlistnew"><?php echo $forum['userlist']?></textarea></td>
        </tr>

===========
Add Above:
===========

        <!-- Forum Based Minimal Posts Needed Mod Begin -->
        <tr class="tablerow">
        <td bgcolor="<?php echo $THEME['altbg1']?>"><?php echo $lang['mpfa']; ?></td>
        <td bgcolor="<?php echo $THEME['altbg2']?>"><input type="text" name="mpfanew" value="<?php echo $forum['mpfa']; ?>" /></td>
        </tr>
        <tr class="tablerow">
        <td bgcolor="<?php echo $THEME['altbg1']?>"><?php echo $lang['mpnp']; ?></td>
        <td bgcolor="<?php echo $THEME['altbg2']?>"><input type="text" name="mpnpnew" value="<?php echo $forum['mpnp']; ?>" /></td>
        </tr>
        <tr class="tablerow">
        <td bgcolor="<?php echo $THEME['altbg1']?>"><?php echo $lang['mpnt']; ?></td>
        <td bgcolor="<?php echo $THEME['altbg2']?>"><input type="text" name="mpntnew" value="<?php echo $forum['mpnt']; ?>" /></td>
        </tr>
        <!-- Forum Based Minimal Posts Needed Mod End -->

======
Find:
======

) VALUES ('forum'

============
Replace With:
============

, mpnt, mpnp, mpfa) VALUES ('forum'

========================
Find At End Of The Same Line:
========================

)");

============
Replace With:
============

, '0', '0', '0')");

======
Find:
======

) VALUES ('group'

============
Replace With:
============

, mpnt, mpnp, mpfa) VALUES ('group'

========================
Find At End Of The Same Line:
========================

)");

============
Replace With:
============

, '0', '0', '0')");

======
Find:
======

) VALUES ('sub'

============
Replace With:
============

, mpnt, mpnp, mpfa) VALUES ('sub'

========================
Find At End Of The Same Line:
========================

)");

============

Replace With:
============

, '0', '0', '0')");

======
Find:
======

        $guestpostingnew = formOnOff('guestpostingnew');

===========
Add Below:
===========

        // Forum Based Minimal Posts Needed Mod Begin
        $mpnpnew = formInt('mpnpnew');
        $mpntnew = formInt('mpntnew');
        $mpfanew = formInt('mpfanew');
        // Forum Based Minimal Posts Needed Mod End

======
Find:
======

        $db->query("UPDATE ".X_PREFIX."forums SET

============
Replace With:
============

        $db->query("UPDATE ".X_PREFIX."forums SET
            mpnp='$mpnpnew',
            mpnt='$mpntnew',
            mpfa='$mpfanew',

=============================================================================================================================
=======
Step 7:
=======
===============
Edit File: post.php
===============
======
Find:
======

loadtemplates(

============
Replace With:
============

loadtemplates(
'forumdisplay_mpn_info',

======
Find:
======

        $query = $db->query("SELECT name, fid FROM ".X_PREFIX."forums WHERE fid='$forums[fup]'");
        $fup = $db->fetch_array($query);
        nav('<a href="forumdisplay.php?fid='.intval($fup['fid']).'">'.html_entity_decode(stripslashes($fup['name'])).'</a>');
        nav('<a href="forumdisplay.php?fid='.$fid.'">'.html_entity_decode(stripslashes($forums['name'])).'</a>');
    }
}

============
Replace With:
============

        $query = $db->query("SELECT name, fid, mpfa, mpnp, mpnt FROM ".X_PREFIX."forums WHERE fid='$forums[fup]'");
        $fup = $db->fetch_array($query);
        // Forum Based Minimal Posts Needed Mod Begin
        $forums['mpfa'] = ($forums['mpfa'] == 0 ? $fup['mpfa'] : $forums['mpfa']);
        $forums['mpnp'] = ($forums['mpnp'] == 0 ? $fup['mpnp'] : $forums['mpnp']);
        $forums['mpnt'] = ($forums['mpnt'] == 0 ? $fup['mpnt'] : $forums['mpnt']);
        // Forum Based Minimal Posts Needed Mod End
        nav('<a href="forumdisplay.php?fid='.intval($fup['fid']).'">'.html_entity_decode(stripslashes($fup['name'])).'</a>');
        nav('<a href="forumdisplay.php?fid='.$fid.'">'.html_entity_decode(stripslashes($forums['name'])).'</a>');
    }
    // Forum Based Minimal Posts Needed Mod Begin
    if ($forums['mpfa'] > 0 && $self['postnum'] < $forums['mpfa'] && !X_ADMIN) {
        $message = str_replace("*posts*", $forums['mpfa'], $lang['mpfae']);
        error($message, true, '', '', false, true, false, true);
    }
    // Forum Based Minimal Posts Needed Mod End
}

======
Find:
======

        if (!isset($topicsubmit) || !$topicsubmit) {

===========
Add Above:
===========

        // Forum Based Minimal Posts Needed Mod Begin
        if ($forum['mpnt'] > 0 && $self['postnum'] < $forum['mpnt'] && !X_ADMIN) {
            eval('echo "'.template('header').'";');
            $showfi = str_replace("*posts*", $forum['mpnt'], $lang['mpnte']);
            eval('echo stripslashes("'.template('forumdisplay_mpn_info').'");');
        } else
        // Forum Based Minimal Posts Needed Mod End

======
Find:
======

        if (!isset($replysubmit) || !$replysubmit) {

===========
Add Above:
===========

        // Forum Based Minimal Posts Needed Mod Begin
        if ($forum['mpnp'] > 0 && $self['postnum'] < $forum['mpnp'] && !X_ADMIN) {
            eval('echo "'.template('header').'";');
            $showfi = str_replace("*posts*", $forum['mpnp'], $lang['mpnpe']);
            eval('echo stripslashes("'.template('forumdisplay_mpn_info').'");');
        } else
        // Forum Based Minimal Posts Needed Mod End

=============================================================================================================================
=======
Step 8:
=======
=====================
Edit File: forumdisplay.php
=====================
======
Find:
======

loadtemplates(

============
Replace With:
============

loadtemplates(
'forumdisplay_mpn_info',

======
Find:
======

$fup = array();
if (isset($forum['type']) && $forum['type'] == 'sub') {
    $query = $db->query("SELECT private, userlist, name, fid FROM ".X_PREFIX."forums WHERE fid='$forum[fup]'");
    $fup = $db->fetch_array($query);
    $db->free_result($query);
    if (!privfcheck($fup['private'], $fup['userlist'])) {
        error($lang['privforummsg']);
    }
} else if (!isset($forum['type']) && $forum['type'] != 'forum') {
    error($notexist);
}

============
Replace With:
============

$fup = array();
if (isset($forum['type']) && $forum['type'] == 'sub') {
    $query = $db->query("SELECT private, userlist, name, mpfa, mpnp, mpnt fid FROM ".X_PREFIX."forums WHERE fid='$forum[fup]'");
    $fup = $db->fetch_array($query);
    if (!privfcheck($fup['private'], $fup['userlist'])) {
        error($lang['privforummsg']);
    }
    // Forum Based Minimal Posts Needed Mod Begin
    $forum['mpfa'] = ($forum['mpfa'] == 0 ? $fup['mpfa'] : $forum['mpfa']);
    $forum['mpnp'] = ($forum['mpnp'] == 0 ? $fup['mpnp'] : $forum['mpnp']);
    $forum['mpnt'] = ($forum['mpnt'] == 0 ? $fup['mpnt'] : $forum['mpnt']);
    // Forum Based Minimal Posts Needed Mod End
} else if (!isset($forum['type']) && $forum['type'] != 'forum') {
    error($notexist);
}

// Forum Based Minimal Posts Needed Mod Begin
if ( $forum['mpfa'] > 0 && $self['postnum'] < $forum['mpfa'] && !X_ADMIN ) {
    $message = str_replace("*posts*", $forum['mpfa'], $lang['mpfae']);
    error($message, true, '', '', false, true, false, true);
}
// Forum Based Minimal Posts Needed Mod End

======
Find:
======

$t_extension = get_extension($lang['toppedprefix']);

===========
Add Above:
===========

// Forum Based Minimal Posts Needed Mod Begin
$minimal_posts_needed = '';
$mpn = array();
if ($forum['mpfa'] > 0) {
    $mpn[] = str_replace("*posts*", $forum['mpfa'], $lang['mpfai']);
}
if ($forum['mpnp'] > 0) {
    $mpn[] = str_replace("*posts*", $forum['mpnp'], $lang['mpnpi']);
    if ($self['postnum'] < $forum['mpnp'] && !X_ADMIN) {
        $replylink = '';
    }
}
if ($forum['mpnt'] > 0) {
    $mpn[] = str_replace("*posts*", $forum['mpnt'], $lang['mpnti']);
    if ($self['postnum'] < $forum['mpnt'] && !X_ADMIN) {
        $newpolllink = $newtopiclink = '';
    }
}
if (count($mpn) > 0) {
    $showfi = implode('<br />', $mpn);
    eval("\$minimal_posts_needed = \"".template("forumdisplay_mpn_info")."<br />\";");
}
// Forum Based Minimal Posts Needed Mod End

=============================================================================================================================
=======
Step 9:
=======
===================
Edit File: viewthread.php
===================
======
Find:
======

loadtemplates(

============
Replace With:
============

loadtemplates(
'forumdisplay_mpn_info',

======
Find:
======

if (isset($forum['type']) && $forum['type'] == 'sub') {
    $query = $db->query("SELECT name, fid, private, userlist FROM ".X_PREFIX."forums WHERE fid='$forum[fup]'");
    $fup = $db->fetch_array($query);
    $db->free_result($query);
    $authorization = privfcheck($fup['private'], $fup['userlist']);
}

============
Replace With:
============

if (isset($forum['type']) && $forum['type'] == 'sub') {
    $query = $db->query("SELECT name, fid, private, userlist, mpfa, mpnp, mpnt FROM ".X_PREFIX."forums WHERE fid='$forum[fup]'");
    $fup = $db->fetch_array($query);
    $db->free_result($query);
    $authorization = privfcheck($fup['private'], $fup['userlist']);
    // Forum Based Minimal Posts Needed Mod Begin
    $forum['mpfa'] = ($forum['mpfa'] == 0 ? $fup['mpfa'] : $forum['mpfa']);
    $forum['mpnp'] = ($forum['mpnp'] == 0 ? $fup['mpnp'] : $forum['mpnp']);
    $forum['mpnt'] = ($forum['mpnt'] == 0 ? $fup['mpnt'] : $forum['mpnt']);
    // Forum Based Minimal Posts Needed Mod End
}

======
Find:
======

if (!$authorization || !privfcheck($forum['private'], $forum['userlist'])) {
    $threadSubject = '';
    error($lang['privforummsg']);
}

===========
Add Below:
===========

// Forum Based Minimal Posts Needed Mod Begin
if ($forum['mpfa'] > 0 && $self['postnum'] < $forum['mpfa'] && !X_ADMIN) {
    $message = str_replace("*posts*", $forum['mpfa'], $lang['mpfae']);
    error($message, true, '', '', false, true, false, true);
}
// Forum Based Minimal Posts Needed Mod End

======
Find:
======

    $topuntop = ($thread['topped'] == 1) ? $lang['textuntopthread'] : $lang['texttopthread'];

===========
Add Above:
===========

    // Forum Based Minimal Posts Needed Mod Begin
    $minimal_posts_needed = '';
    $mpn = array();
    if ($forum['mpfa'] > 0) {
        $mpn[] = str_replace("*posts*", $forum['mpfa'], $lang['mpfai']);
    }
    if ($forum['mpnp'] > 0) {
        $mpn[] = str_replace("*posts*", $forum['mpnp'], $lang['mpnpi']);
        if ( $self['postnum'] < $forum['mpnp'] && !X_ADMIN ) {
            $replylink = $quickreply = '';
        }
    }
    if ($forum['mpnt'] > 0) {
        $mpn[] = str_replace("*posts*", $forum['mpnt'], $lang['mpnti']);
        if ( $self['postnum'] < $forum['mpnt'] && !X_ADMIN ) {
            $newpolllink = $newtopiclink = '';
        }
    }
    if (count($mpn) > 0) {
        $showfi = implode('<br />', $mpn);
        eval("\$minimal_posts_needed = \"".template("forumdisplay_mpn_info")."<br />\";");
    }
    // Forum Based Minimal Posts Needed Mod End

=============================================================================================================================
========
Step 10:
========
================
Edit File: today.php
================
======
Find:
======

    $q = $db->query("SELECT fid, type, fup FROM ".X_PREFIX."forums WHERE status='on' AND $restrict");
    while($f = $db->fetch_array($q)) {
        if (isset($f['type']) && $f['type'] == 'sub') {
            $query = $db->query("SELECT private, userlist, name, fid FROM ".X_PREFIX."forums WHERE fid='$f[fup]'");
            $fup = $db->fetch_array($query);
            if (privfcheck($fup['private'], $fup['userlist'])) {
                $fids[] = $f['fid'];
            }
            $db->free_result($query);
        } else {
            $fids[] = $f['fid'];
        }
    }
    $db->free_result($q);

============
Replace With:
============

    // Forum Based Minimal Posts Needed Mod Begin
    $q = $db->query("SELECT fid, type, fup, mpfa, mpnp, mpnt FROM ".X_PREFIX."forums WHERE status='on' AND $restrict");
    while($f = $db->fetch_array($q)) {
        if (isset($f['type']) && $f['type'] == 'sub') {
            $query = $db->query("SELECT private, userlist, name, fid FROM ".X_PREFIX."forums WHERE fid='$f[fup]'");
            $fup = $db->fetch_array($query);
            $f['mpfa'] = ($f['mpfa'] == 0 ? $fup['mpfa'] : $f['mpfa']);
            $MPN = ($f['mpfa'] > 0 && $self['postnum'] < $f['mpfa']); // true = no access
            if (privfcheck($fup['private'], $fup['userlist']) && !$MPN) {
                $fids[] = $f['fid'];
            }
        } else {
            if (!( $f['mpfa'] > 0 && $self['postnum'] < $f['mpfa'])) { // true = no access
                $fids[] = $f['fid'];
            }
        }
    }
    $db->free_result($q);
    // Forum Based Minimal Posts Needed Mod End

=============================================================================================================================
========
Step 11:
========
===============
Edit File: misc.php
===============
======
Find:
======

(This code is for 1.9.8 SP3)
                $sql = "SELECT p.*, t.tid AS ttid, t.subject AS tsubject, f.fup AS fup, f.type AS type, f.fid, f.private AS fprivate, f.userlist AS fuserlist, f.password AS password FROM ".X_PREFIX."posts p, ".X_PREFIX."threads t LEFT JOIN ".X_PREFIX."forums f ON f.fid=t.fid WHERE p.tid=t.tid";

(This code is for 1.9.8 SP4)
                $sql = "SELECT COUNT(p.tid), p.*, m.status AS status, m.username, t.tid AS ttid, t.subject AS tsubject, t.replies+1 AS posts, f.fid, f.private AS fprivate, f.userlist AS fuserlist, f.password AS password FROM (".X_PREFIX."posts p, ".X_PREFIX."threads t) LEFT JOIN ".X_PREFIX."members m ON m.username=p.author LEFT JOIN ".X_PREFIX."forums f ON  f.fid=t.fid WHERE p.tid=t.tid";

============
Replace With:
============

(This code is for 1.9.8 SP3)
                $sql = "SELECT p.*, t.tid AS ttid, t.subject AS tsubject, f.mpfa AS mpfa, f.mpnp AS mpnp, f.mpnt AS mpnt, f.fup AS fup, f.type AS type, f.fid, f.private AS fprivate, f.userlist AS fuserlist, f.password AS password FROM ".X_PREFIX."posts p, ".X_PREFIX."threads t LEFT JOIN ".X_PREFIX."forums f ON f.fid=t.fid WHERE p.tid=t.tid";

(This code is for 1.9.8 SP4)
                $sql = "SELECT COUNT(p.tid), p.*, m.status AS status, m.username, t.tid AS ttid, t.subject AS tsubject, f.mpfa AS mpfa, f.mpnp AS mpnp, f.mpnt AS mpnt, f.fup AS fup, t.replies+1 AS posts, f.fid, f.private AS fprivate, f.userlist AS fuserlist, f.password AS password FROM (".X_PREFIX."posts p, ".X_PREFIX."threads t) LEFT JOIN ".X_PREFIX."members m ON m.username=p.author LEFT JOIN ".X_PREFIX."forums f ON  f.fid=t.fid WHERE p.tid=t.tid";

===============
Find (2 Instances):
===============

                        if (isset($post['type']) && $post['type'] == 'sub') {
                            $query = $db->query("SELECT private, userlist, name, fid FROM ".X_PREFIX."forums WHERE fid='$post[fup]'");
                            $fup = $db->fetch_array($query);
                            if (!privfcheck($fup['private'], $fup['userlist'])) {
                                continue;
                            }
                            $db->free_result($query);
                        }

=====================
Replace With (2 Instances):
=====================

                        if (isset($post['type']) && $post['type'] == 'sub') {
                            $query = $db->query("SELECT private, userlist, name, fid FROM ".X_PREFIX."forums WHERE fid='$post[fup]'");
                            $fup = $db->fetch_array($query);
                            // Forum Based Minimal Posts Needed Mod Begin
                            $post['mpfa'] = ($post['mpfa'] == 0 ? $fup['mpfa'] : $post['mpfa']);
                            $MPN = ($post['mpfa'] > 0 && $self['postnum'] < $post['mpfa']); // true = no access
                            // Forum Based Minimal Posts Needed Mod End
                            if (!privfcheck($fup['private'], $fup['userlist'])) {
                                continue;
                            }
                            $db->free_result($query);
                        } else {
                            // Forum Based Minimal Posts Needed Mod Begin
                            if ($post['mpfa'] > 0 && $self['postnum'] < $post['mpfa']) { // true = no access
                                continue;
                            }
                            // Forum Based Minimal Posts Needed Mod End
                        }

=============================================================================================================================
========
Step 12:
========
===============================================================
If you want to hide the forums that people don't have access to then proceed with this step.
===============================================================
================
Edit File: index.php
================
======
Find:
======

eval('echo "'.template('header').'";');

===========
Add Below:
===========

// Minimal Posts Needed Mod Begin
$minimal_posts_needed = '';
if (!X_ADMIN) {
    $minimal_posts_needed = ' AND '.$self['postnum'].' >= f.mpfa';
}
// Minimal Posts Needed Mod End

======
Find:
======

        $fquery = $db->query("SELECT f.*, c.name as cat_name, c.fid as cat_fid FROM ".X_PREFIX."forums f LEFT JOIN ".X_PREFIX."forums c ON (f.fup=c.fid) WHERE (c.type='group' AND f.type='forum' AND c.status='on' AND f.status='on') OR (f.type='forum' AND f.fup='' AND f.status='on') ORDER BY c.displayorder ASC, f.displayorder ASC");
    }
} else {
    $ticker = $welcome = $whosonline = $statsbar = $whosonlinetoday = '';
    $fquery = $db->query("SELECT f.*, c.name as cat_name, c.fid as cat_fid FROM ".X_PREFIX."forums f LEFT JOIN ".X_PREFIX."forums c ON (f.fup=c.fid) WHERE (c.type='group' AND f.type='forum' AND c.status='on' AND f.status='on' AND f.fup='$gid') ORDER BY c.displayorder ASC, f.displayorder ASC");
}

--------------------------------------------------
Replace With:
--------------------------------------------------

        $fquery = $db->query("SELECT f.*, c.name as cat_name, c.fid as cat_fid FROM ".X_PREFIX."forums f LEFT JOIN ".X_PREFIX."forums c ON (f.fup=c.fid) WHERE (c.type='group' AND f.type='forum' AND c.status='on' AND f.status='on'$minimal_posts_needed) OR (f.type='forum' AND f.fup='' AND f.status='on'$minimal_posts_needed) ORDER BY c.displayorder ASC, f.displayorder ASC");
    }
} else {
    $ticker = $welcome = $whosonline = $statsbar = $whosonlinetoday = '';
    $fquery = $db->query("SELECT f.*, c.name as cat_name, c.fid as cat_fid FROM ".X_PREFIX."forums f LEFT JOIN ".X_PREFIX."forums c ON (f.fup=c.fid) WHERE (c.type='group' AND f.type='forum' AND c.status='on' AND f.status='on' AND f.fup='$gid'$minimal_posts_needed) ORDER BY c.displayorder ASC, f.displayorder ASC");
}

=============================================================================================================================
========
Step 13:
========
=================
Edit File: header.php
=================
======
Find:
======

    $xmbpwinput = '';
    $self['status'] = '';

===========
Add Below:
===========

    // Minimal Posts Needed Mod Begin
    $self['postnum'] = 0;
    // Minimal Posts Needed Mod End

======
Find:
======

    $self['sig'] = '';

===========
Add Below:
===========

    // Minimal Posts Needed Mod Begin
    $self['postnum'] = 0;
    // Minimal Posts Needed Mod End

=============================================================================================================================
Enjoy!