News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SMFPacks Minimun Characters or Words Mod

Started by Nibogo, December 05, 2008, 03:31:53 PM

Previous topic - Next topic

KensonPlays

Will this ever be updated to rc2, I'd love to use this on my general discussion forum!

Owner of Mesozoic Haven

Nibogo

Quote from: Kcmartz on February 11, 2010, 01:59:47 PM
Will this ever be updated to rc2, I'd love to use this on my general discussion forum!

With more than 1000 posts you should know that posting things like "I need it for RC2" or "Will this be updated to RC2" will not make the mod authors to update it soon just because you need it or want it. If you need it so bad you should code your own mod otherwise be patient.


shakaran

Are you Spanish? Please include support for spanish_es and spanish_es-utf8. I use that locale. Thanks. It is easy modify the lang file.
My blog: http://www.shakaran.net
Quijost: professional & reliable webhosting (with SMF support) http://www.quijost.com
Tivion: a player for streaming TV and Radio channels http://www.shakaran.net/blog/tivion
Spanish RPG game: http://www.apogeus.es & http://www.apogeus.es/ao

MaXiForum.cz



Sakae

Quote from: NIBOGO on February 11, 2010, 02:09:40 PM
Quote from: Kcmartz on February 11, 2010, 01:59:47 PM
Will this ever be updated to rc2, I'd love to use this on my general discussion forum!

With more than 1000 posts you should know that posting things like "I need it for RC2" or "Will this be updated to RC2" will not make the mod authors to update it soon just because you need it or want it. If you need it so bad you should code your own mod otherwise be patient.

Quote from: NIBOGO on February 13, 2010, 02:04:11 PM
Changelog:

1.1 - 13 Feb 2010

o Some Code Improvements. (Now the mod is two times faster)
o Added Option to Doesn't Count Chars and Words between [quote] BBCode.
o Added Support for SMF 2.0 RC2.

LMAO

Thanks for upgrading, it's working fine on my SMF 2.0 RC 2! :)
http://www.tigrelog.com.br
l: simple p: machines

KensonPlays

Quote from: NIBOGO on February 11, 2010, 02:09:40 PM
Quote from: Kcmartz on February 11, 2010, 01:59:47 PM
Will this ever be updated to rc2, I'd love to use this on my general discussion forum!

With more than 1000 posts you should know that posting things like "I need it for RC2" or "Will this be updated to RC2" will not make the mod authors to update it soon just because you need it or want it. If you need it so bad you should code your own mod otherwise be patient.
The thing is I am busy with school and don't have time to learn the SMF code and it's language (PHP and XML for the mods)

Owner of Mesozoic Haven

Nibogo

Quote from: Sakae on February 14, 2010, 06:27:26 PM
Quote from: NIBOGO on February 11, 2010, 02:09:40 PM
Quote from: Kcmartz on February 11, 2010, 01:59:47 PM
Will this ever be updated to rc2, I'd love to use this on my general discussion forum!

With more than 1000 posts you should know that posting things like "I need it for RC2" or "Will this be updated to RC2" will not make the mod authors to update it soon just because you need it or want it. If you need it so bad you should code your own mod otherwise be patient.

Quote from: NIBOGO on February 13, 2010, 02:04:11 PM
Changelog:

1.1 - 13 Feb 2010

o Some Code Improvements. (Now the mod is two times faster)
o Added Option to Doesn't Count Chars and Words between [quote] BBCode.
o Added Support for SMF 2.0 RC2.

LMAO

Thanks for upgrading, it's working fine on my SMF 2.0 RC 2! :)

Glad you like it and btw the Kc posts didn't make of I upgrade it as you can see I was updating my mods yesterday. (and I'm finishing the new version of the SMF Topic Prefix Mod).

Quote from: Kcmartz on February 14, 2010, 08:03:40 PM
Quote from: NIBOGO on February 11, 2010, 02:09:40 PM
Quote from: Kcmartz on February 11, 2010, 01:59:47 PM
Will this ever be updated to rc2, I'd love to use this on my general discussion forum!

With more than 1000 posts you should know that posting things like "I need it for RC2" or "Will this be updated to RC2" will not make the mod authors to update it soon just because you need it or want it. If you need it so bad you should code your own mod otherwise be patient.
The thing is I am busy with school and don't have time to learn the SMF code and it's language (PHP and XML for the mods)

But even knowing that you are busy with the school you should know that:

"posting things like "I need it for RC2" or "Will this be updated to RC2" will not make the mod authors to update it soon just because you need it or want it. If you need it so bad you should code your own mod otherwise be patient."

In the future you have two options be patient or code ;)

navjotjsingh

Works on 2.0 RC3 but just need to emulate the version number to 2.0 RC2 to install. :)





ɔɔɔɔɔɔuɥoɾ

Nice, I think I will use this. I had to different mods before doing these both things.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers


agent47

Hey bud I was wondering if you can tell me how I can remove limitations for certain post-count membergroups as in like disable the minimum number of characters to members who reached atleast 100 posts. Can this be done? I would be really grateful if you can guide through in order to achieve this..

PortaMx is probably the best SMF portal!

saosangmo

Hi Nibogo,
Could you help me debug why I see in my error center the below words:

"
http://www.mydomain.yyy/index.php?action=admin;area=logs;sa=errorlog;desc
8: Undefined index: minChar
File: /home/xxx /yyy /Themes/default/languages/index.vietnamese-utf8.php (eval?)
Line: 203
"

thank you

Solistia

I wonder if it would be possible to have word count minimums set by each board, and not a single global setting?

I'd like to use this for a role-playing forum, to force our roleplayers to meet a minimum word count when RPing (about 100 words) without having to check every post, but we also want people to have to ability to make shorter posts in non-roleplay areas.

Is this a possibility?

AcEAndroid

#59
I was able to add the ability to remove both specific member groups and specific boards from the set limitations.

I was able to add this to the Admin settings, but because of a problem with integers (and probably because of my lack of php knowledge) I was only able to make the settings remove a single member, and a single board from the limitations.

Code Changes From Scratch

./Themes/default/languages/Modifications.english.php
Code (Find (at end of file)) Select

?>


Code (Add Before) Select

//Minimun Characters or Words Mod
$txt['minWordLen'] = 'Minimum words per post';
$txt['minwords_mod'] = 'words';
$txt['minChar'] = 'Minimum characters per post';
$txt['minchars_mod'] = 'characters';
$txt['minmod_zero'] = '0 for no minimum.';
$txt['minAdminLen'] = 'Ignore the minimun characters or words of Admins';
$txt['minCountQuote'] = 'Count the Words and Characters Between [QUOTE] BBCode';
$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).';





./Sources/ManagePosts.php
Code (Find) Select

// All, next/prev...
array('int', 'enableAllMessages', 'postinput' => $txt['manageposts_posts'], 'subtext' => $txt['enableAllMessages_zero']),
array('check', 'disableCustomPerPage'),
array('check', 'enablePreviousNext'),


Code (Replace With) Select

// All, next/prev...
array('int', 'enableAllMessages', 'postinput' => $txt['manageposts_posts'], 'subtext' => $txt['enableAllMessages_zero']),
array('check', 'disableCustomPerPage'),
array('check', 'enablePreviousNext'),
'',
        array('int', 'minWordLen', 'postinput' => $txt['minwords_mod'], 'subtext' => $txt['minmod_zero']),
    array('int', 'minChar', 'postinput' => $txt['minchars_mod'], 'subtext' => $txt['minmod_zero']),
                array('check', 'minAdminLen'),
array('check', 'minCountQuote'),





./Sources/Post.php
Code (Find) Select

// Check the subject and message.
if (!isset($_POST['subject']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['subject'])) === '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['message']), ENT_QUOTES) === '')
$post_errors[] = 'no_message';
elseif (!empty($modSettings['max_messageLength']) && $smcFunc['strlen']($_POST['message']) > $modSettings['max_messageLength'])
$post_errors[] = 'long_message';


Code (Replace With) Select

// Check if the message is to short, and if that is acceptable
if (in_array($context['current_board'], array(1, 2, 3)))
{
}
else
{
if (in_array($user_info['groups'], array(1, 2, 3)))
{
}
else
{
if (!empty($modSettings['minWordLen']) && (empty($modSettings['minAdminLen']) || (!empty($modSettings['minAdminLen']) && !$context['user']['is_admin'])))
{
    $message = $_POST['message'];
if (empty($modSettings['minCountQuote']))
    $message = trim(preg_replace('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '', $message));

preg_match_all('/\S+/', $message, $matches);
       
        if ((count($matches[0]) < (int)$modSettings['minWordLen']))
            $post_errors[] = 'minWordLen';
    }
       
if (!empty($modSettings['minChar']) && (empty($modSettings['minAdminLen']) || (!empty($modSettings['minAdminLen']) && !$context['user']['is_admin'])))
    {
    $message = $_POST['message'];
    if (empty($modSettings['minCountQuote']))
       $message = trim(preg_replace('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '', $message));
        if (($smcFunc['strlen']($message) < (int)$modSettings['minChar']))
           $post_errors[] = 'minChar';

}
}
// Check the subject and message.
if (!isset($_POST['subject']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['subject'])) === '')
$post_errors[] = 'no_subject';
if (!isset($_POST['message']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['message']), ENT_QUOTES) === '')
$post_errors[] = 'no_message';
elseif (!empty($modSettings['max_messageLength']) && $smcFunc['strlen']($_POST['message']) > $modSettings['max_messageLength'])
$post_errors[] = 'long_message';


In the above code you see this:



if (in_array($context['current_board'], array(1, 2, 3)))
   {
   }
   else
   {
   if (in_array($user_info['groups'], array(1, 2, 3)))


The 1, 2, 3 in both of those arrays are the Id's of the boards, and the id's of the member groups.

For example, in my forum, the first array is         array(20, 21, 27)
This makes it so that people can type any message size they want in the spam boards (boards 20, 21, and 27)

And my second array, looks like this          array(12)
This makes it so that the member group who's id is 12 (in the case of my forum, people with more than 500 posts) are allowed to post any message size anywhere on the forum.


I have working code that adds these settings to the admin panel, but like I said, It only allowes you to add 1 board and 1 member group the the exclusion list.

If anyone want's that code, just ask.

Advertisement: