============================================================================================================================
Modification Title: Forum Based Post Count Control

Version: 1.0

Author: John Briggs

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

Copyright:  2010 John Briggs. All Rights Reserved.

Compatability: XMB 1.9.5 SP1

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 v3. 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 Administration Panel --> Insert Raw SQL
====================================

Upload provided file named "SQL.txt" and 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:
==========

        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textdesc']?></td>
        <td bgcolor="<?php echo $altbg2?>"><textarea rows="4" cols="30" name="descnew"><?php echo htmlspecialchars($forum['description'])?></textarea></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 $table_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-Line In Above Statement:
=============================

 ) VALUES ('forum',

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

, fpcount ) VALUES ('forum',

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

)");

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

, 'yes')");

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

            if ($newgname != $lang['textnewgroup']) {
                $newgname = addslashes($newgname);
                $db->query("INSERT INTO $table_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-Line In Above Statement:
=============================

 ) VALUES ('group',

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

, fpcount ) VALUES ('group',

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

)");

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

, 'yes')");

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

            if ($newsubname != $lang['textnewsubf']) {
                $newsubname = addslashes($newsubname);
                $db->query("INSERT INTO $table_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-Line In Above Statement:
=============================

 ) VALUES ('sub',

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

, fpcount ) VALUES ('sub',

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

)");

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

, 'yes')");

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

            $guestpostingnew = (isset($guestpostingnew) && $guestpostingnew == 'on') ? 'on' : 'off';

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

            // Forum Based Post Count Control Mod Begin
            $fpcountnew = (isset($fpcountnew) && $fpcountnew == 'yes') ? 'yes' : 'no';
            // Forum Based Post Count Control Mod End

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

            $db->query("UPDATE $table_forums SET name='$namenew',

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

 WHERE fid='$fdetails'");

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

, fpcount='$fpcountnew' WHERE fid='$fdetails'");

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

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

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

        if ($forums['fpcount'] == 'yes') {
            $db->query("UPDATE $table_members SET postnum=postnum+1 WHERE username like '$username'");
        }

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

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

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

            if ($forums['fpcount'] == 'yes') {
                $db->query("UPDATE $table_members SET postnum=postnum+1 WHERE username='$username'");
            }

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

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

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

                if ($forums['fpcount'] == 'yes') {
                    $db->query("UPDATE $table_members SET postnum=postnum-1 WHERE username='$orig[author]'");
                }

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

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

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

                        if ($forums['fpcount'] == 'yes') {
                            $db->query("UPDATE $table_members SET postnum=postnum-1 WHERE username='$result[author]'");
                        }
                    }

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

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

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

                    if ($forums['fpcount'] == 'yes') {
                        $db->query("UPDATE $table_members SET postnum=postnum-1 WHERE username='$orig[author]'");
                    }

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

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

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

            $query = $db->query("SELECT author FROM $table_posts WHERE tid='$tid'");
            while($result = $db->fetch_array($query)) {
                if ($result['pid']  == $isfirstpost['pid']) {
                    if ($forums['fpcount'] == 'yes') {
                        $db->query("UPDATE $table_members SET postnum=postnum-1 WHERE username='$result[author]'");
                    }
                }
            }
============================================================================================================================
=======
Step 5:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above  ?>
============================

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

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