Title: Forum Based Minimal Chars Per Post v1.0

Author: John Briggs

Description:
This mod will allow you to set in forum options the minimal characters required in posts in order to post.

Compatability: XMB 1.9.5

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

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

Author Note:
You downloaded this hack from XMBMods.com, the #1 source for XMB related downloads.
Please visit http://www.xmbmods.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:
==========

        $forum['description'] = stripslashes($forum['description']);

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

        $forum['minchars'] = (int) $forum['minchars'];

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

        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textforumname']?></td>
        <td bgcolor="<?php echo $altbg2?>"><input type="text" name="namenew" value="<?php echo htmlspecialchars($forum['name'])?>" /></td>
        </tr>

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

        <?php
        printsetting2($lang['minchars'], 'mincharsnew', $forum['minchars'], 2);
        ?>

==========
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 Above Statement In-line:
=====================================

 ) VALUES ('forum',

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

, minchars ) VALUES ('forum',

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

)");

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

, '0')");

==========
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 Above Statement In-line:
=====================================

 ) VALUES ('group',

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

, minchars ) VALUES ('group',

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

)");

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

, '0')");

==========
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 Above Statement In-line:
=====================================

 ) VALUES ('sub',

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

, minchars ) VALUES ('sub',

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

)");

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

, '0')");

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

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

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

 WHERE fid='$fdetails'");

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

, minchars='$mincharsnew' WHERE fid='$fdetails'");

=======================================================================================================================================
=======
Step 3:
=======

===================
Edit File: post.php
===================

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

        if ( $forums['guestposting'] != "on" && $username == "Anonymous") {
            error($lang['textnoguestposting']);
        }

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

        $forums['minchars'] = intval($forums['minchars']);
        if (strlen($message) < $forums['minchars']) {
            $message = str_replace("*chars*", $forums['minchars'], $lang['mincharsmsg']);
            error($message);
        }

===================
Find Code & Delete:
===================

        if (!$subject && !$message) {
            error($lang['postnothing']);
        }

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

        if ( $forums['guestposting'] != "on" && $username == "Anonymous") {
            error($lang['textnoguestposting']);
        }

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

        if (trim($message) == '') {
            error($lang['mincharsnomsg']);
        }

        $forums['minchars'] = intval($forums['minchars']);
        if (strlen($message) < $forums['minchars']) {
            $message = str_replace("*chars*", $forums['minchars'], $lang['mincharsmsg']);
            error($message);
        }

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

        if((trim($subject) == '' && $pid == $isfirstpost['pid']) && !(isset($delete) && $delete == "yes")) {
            error($lang['textnosubject']);
        }

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

        if (trim($message) == '') {
            error($lang['mincharsnomsg']);
        }

        $forums['minchars'] = intval($forums['minchars']);
        if (strlen($message) < $forums['minchars']) {
            $message = str_replace("*chars*", $forums['minchars'], $lang['mincharsmsg']);
            error($message);
        }

=======================================================================================================================================
=======
Step 4:
=======

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

================================
Add Code At Very Bottom Of File:
================================

$lang['minchars'] = "Minimal chars per post needed:<br /><span class=\"smalltxt\">If set to 0 then there is no minimal.</span>";
$lang['mincharsmsg'] = "Sorry, You need at least *chars* post characters to be able to post in this forum. Please go back and try again.";
$lang['mincharsnomsg'] = "You entered no message. Please go back and do so now";

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