<id>aitsukai:minwords</id>
<version>1.0.0</version>
<edit file>
$themedir/languages/Errors.english.php
</edit file>
<search for>
$txt['error_long_message'] = 'The message exceeds the maximum allowed length (' . $modSettings['max_messageLength'] . ' characters).';
</search for>
<add after>
$txt['error_minWordLen'] = 'The message does not meet the minimum word requirements (' . $modSettings['minWordLen'] . ' words).';
$txt['error_minChar'] = 'The message does not meet the minimum character requirements (' . $modSettings['minChar'] . ' characters).';
</add after>
<edit file>
$sourcedir/Post.php
</edit file>
<search for>
// Check the subject and message.
</search for>
<add after>
if (!empty($modSettings['minWordLen']) && ((int)$modSettings['minWordLen'] != 0))
{
$Temp = trim(preg_replace('~[^a-z0-9 ]~si', '', $_POST['message']));
$Temp = preg_replace('~(( )+)~si', ' ', $Temp);
$WordArr = explode(' ', $Temp);
if (count($WordArr) < (int)$modSettings['minWordLen'])
$post_errors[] = 'minWordLen';
}
if (!empty($modSettings['minChar']) && ((int)$modSettings['minChar'] != 0))
{
if (strlen($_POST['message']) < (int)$modSettings['minChar'])
$post_errors[] = 'minChar';
}
</add after>
<edit file>
$sourcedir/ManagePosts.php
</edit file>
<search for>
// Update the actual settings.
updateSettings(array(
</search for>
<add after>
'minWordLen' => empty($_POST['minWordLen']) ? '0' : (int) $_POST['minWordLen'],
'minChar' => empty($_POST['minChar']) ? '0' : (int) $_POST['minChar'],
</add after>
<edit file>
$themedir/languages/Admin.english.php
</edit file>
<search for>
$txt['caching_settings'] = 'Caching';
</search for>
<add after>
$txt['minWordLen'] = 'Minimum words per post';
$txt['minWordLen_zero'] = '0 for no minimum.';
$txt['minWordLen_words'] = 'words';
$txt['minChar'] = 'Minimum characters per post';
$txt['minChar_zero'] = '0 for no minimum.';
$txt['minChar_chars'] = 'characters';
</add after>
<edit file>
$themedir/Admin.template.php
</edit file>
<search for>
<td valign="top">
<input type="text" name="max_messageLength" id="max_messageLength_input" value="', empty($modSettings['max_messageLength']) ? '0' : $modSettings['max_messageLength'], '" size="5" /> ', $txt['manageposts_characters'], '
</td>
</tr>
</search for>
<add after>
<tr class="windowbg2">
<th width="50%" align="right">
<label for="minWordLen_input">', $txt['minWordLen'], ':
<div class="smalltext" style="font-weight: normal;">', $txt['minWordLen_zero'], '</div>
</th>
<td valign="top">
<input type="text" name="minWordLen" id="minWordLen_input" value="', empty($modSettings['minWordLen']) ? '5' : $modSettings['minWordLen'], '" size="5" /> ', $txt['minWordLen_words'], '
</td>
</tr>
<tr class="windowbg2">
<th width="50%" align="right">
<label for="minChar_input">', $txt['minChar'], ':
<div class="smalltext" style="font-weight: normal;">', $txt['minChar_zero'], '</div>
</th>
<td valign="top">
<input type="text" name="minChar" id="minChar_input" value="', empty($modSettings['minChar']) ? '100' : $modSettings['minChar'], '" size="5" /> ', $txt['minChar_chars'], '
</td>
</tr>
</add after>