Title: Forum Based Post Count Control v1.0

Author: John Briggs

Description:
This modification will provide a option in your forum options to allow/dissalow post count increase for members.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.8 SP3

Install Note: Before adding this modification to your forum you should back up all files related to this modification.

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

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.

=======================================================================================================================================
=======
Step 1:
=======

==============================
Go To Admin Panel -> Insert Raw SQL
==============================

Upload provided file named "SQL.txt" & click "Submit Changes" button.

=======================================================================================================================================
=======
Step 2:
=======
==============
Edit File: cp.php
==============
==========
Find Code:
==========

        $type31 = $type32 = $type33 = $type34 = '';
        if ($forum['private'] == 2) {
            $type32 = $selHTML;
        } elseif ($forum['private'] == 3) {
            $type33 = $selHTML;
        } elseif ($forum['private'] == 4) {
            $type34 = $selHTML;
        } elseif ($forum['private'] == 1) {
            $type31 = $selHTML;
        }

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

        // Forum Based Post Count Control Mod Begin
        $fpcountyes = $fpcountno = '';
        switch ($forum['fpcount']) {
            case 'yes':
                $fpcountyes = $selHTML;
                break;
            default:
                $fpcountno  = $selHTML;
                break;
        }
        // Forum Based Post Count Control Mod End

==========
Find Code:
==========

        <input type="checkbox" name="guestpostingnew" value="on" <?php echo $checked8?> /><?php echo $lang['textanonymousposting']?><br />
        </td>
        </tr>

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

        <!-- Forum Based Post Count Control Mod Begin -->
        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['fpcountstatus']?></td>
        <td bgcolor="<?php echo $altbg2?>">
        <select name="fpcountnew">
        <option value="yes" <?php echo $fpcountyes?>><?php echo $lang['textyes']?></option>
        <option value="no" <?php echo $fpcountno?>><?php echo $lang['textno']?></option>
        </select>
        </td>
        </tr>
        <!-- Forum Based Post Count Control Mod End -->

==========
Find Code:
==========

        if ($newfname != $lang['textnewforum']) {
            $newfname = addslashes($newfname);
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, private, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, pollstatus, password, guestposting) VALUES ('forum', '$newfname', '$newfstatus', '', '', ".(int)$newforder.", '1', '', 'no', 'yes', 'yes', '', 0, 0, 0, ".(int)$newffup.", '1|1', 'yes', 'on', 'on', '', 'off')");
        }

=============================
Find Code In Above Statement In-line:
=============================

 ) VALUES ('forum',

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

, fpcount) VALUES ('forum',

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

)");

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

, 'yes')");

==========
Find Code:
==========

        if ($newgname != $lang['textnewgroup']) {
            $newgname = addslashes($newgname);
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, private, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, pollstatus, password, guestposting) VALUES ('group', '$newgname', '$newgstatus', '', '', ".(int)$newgorder.", '', '', '', '', '', '', 0, 0, 0, 0, '', '', '', '', '', 'off')");
        }

=============================
Find Code In Above Statement In-line:
=============================

) VALUES ('group',

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

, fpcount) VALUES ('group',

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

)");

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

, 'yes')");

==========
Find Code:
==========

        if ($newsubname != $lang['textnewsubf']) {
            $newsubname = addslashes($newsubname);
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, private, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, pollstatus, password, guestposting) VALUES ('sub', '$newsubname', '$newsubstatus', '', '', ".(int)$newsuborder.", '1', '', 'no', 'yes', 'yes', '', 0, 0, 0, ".(int)$newsubfup.", '1|1', 'yes', 'on', 'on', '', 'off')");
        }

=============================
Find Code In Above Statement In-line:
=============================

) VALUES ('sub',

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

, fpcount) VALUES ('sub',

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

)");

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

, 'yes')");

==========
Find Code:
==========

        $guestpostingnew = formOnOff('guestpostingnew');

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

        // Forum Based Post Count Control Mod Begin
        $fpcountnew = formYesNo('fpcountnew');
        // Forum Based Post Count Control Mod End

==========
Find Code:
==========

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

================
Replace Code With:
================
        $db->query("UPDATE ".X_PREFIX."forums SET
            fpcount='$fpcountnew',

=======================================================================================================================================
=======
Step 3:
=======
===============
Edit File: post.php
===============
==========
Find Code:
==========

            $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum+1 WHERE username like '$username'");

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

            // Forum Based Post Count Control Mod Begin
            if ($forums['fpcount'] == 'yes') {
                $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum+1 WHERE username like '$username'");
            }
            // Forum Based Post Count Control Mod End

==========
Find Code:
==========

                $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum+1 WHERE username='$username'");

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

                // Forum Based Post Count Control Mod Begin
                if ($forums['fpcount'] == 'yes') {
                    $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum+1 WHERE username='$username'");
                }
                // Forum Based Post Count Control Mod End

==========
Find Code:
==========

                    $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$orig[author]'");

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

                    // Forum Based Post Count Control Mod Begin
                    if ($forums['fpcount'] == 'yes') {
                        $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$orig[author]'");
                    }
                    // Forum Based Post Count Control Mod End

==========
Find Code:
==========

                            $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$result[author]'");

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

                            // Forum Based Post Count Control Mod Begin
                            if ($forums['fpcount'] == 'yes') {
                                $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$result[author]'");
                            }
                            // Forum Based Post Count Control Mod End
                        
==========
Find Code:
==========

                        $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$orig[author]'");

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

                        // Forum Based Post Count Control Mod Begin
                        if ($forums['fpcount'] == 'yes') {
                            $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$orig[author]'");
                        }
                        // Forum Based Post Count Control Mod End

=======================================================================================================================================
=======
Step 4:
=======
===================
Edit File: topicadmin.php
===================
==========
Find Code:
==========

                $query = $db->query("SELECT author FROM ".X_PREFIX."posts WHERE tid='$tid'");
                while($result = $db->fetch_array($query)) {
                    $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$result[author]'");
                }

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

                // Forum Based Post Count Control Mod Begin
                $query = $db->query("SELECT author FROM ".X_PREFIX."posts WHERE tid='$tid'");
                while($result = $db->fetch_array($query)) {
                    if ($result['pid']  == $isfirstpost['pid']) {
                        if ($forums['fpcount'] == 'yes') {
                            $db->query("UPDATE ".X_PREFIX."members SET postnum=postnum-1 WHERE username='$result[author]'");
                        }
                    }
                }
                // Forum Based Post Count Control Mod End

=======================================================================================================================================
=======
Step 5:
=======
=======================
Edit File: lang/English.lang.php
=======================

==================================
Add Code At Very Bottom Of File Above ?>
==================================

// Forum Based Post Count Control Mod Begin
$lang['fpcountstatus'] = "Allow post count increases in this forum?";
// Forum Based Post Count Control Mod End

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