Page 1 of 1

Minimum chars on new topic

Posted: Fri Dec 16, 2016 12:49 pm
by olsserik
Hi,

Minimum chars only when posting a new topic? I dont want to add this function to replies, possible?

Thanks!

Re: Prevent members to start new topics containing only links?

Posted: Fri Dec 16, 2016 12:59 pm
by KevC
Put them on a moderation queue. If they can't learn you have to treat them like children. It's your board, the rules are the rules.

MOD requests for 3.0 are no longer allowed so if you can't find a MOD out there to do it already you'll need to think about going to 3.1 and requesting an extension.

Re: Prevent members to start new topics containing only links?

Posted: Fri Dec 16, 2016 1:41 pm
by canonknipser
KevC wrote:going to 3.1 and requesting an extension.
No need to request an extension, just install

Re: Prevent members to start new topics containing only links?

Posted: Fri Dec 16, 2016 2:57 pm
by RMcGirr83
There is also the 3.0 MOD

Re: Minimum chars on new topic

Posted: Tue Dec 20, 2016 8:02 am
by olsserik
Thanks!

Re: Minimum chars on new topic

Posted: Tue Dec 20, 2016 9:07 am
by olsserik
Ok, I have an edit that might work, if someone is willing to find pitfalls in this feel free.

I made edits to posting.php (line ~792) find:

Code: Select all

$error[] = $user->lang['EMPTY_SUBJECT'];
}
Add after (on a new line):

Code: Select all

		// Check for minimum length of text with URLs excluded and only on new topic
		if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id))
		{
			$stringg = preg_replace('/\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $message_parser->message);
			$lengthh = utf8_strlen($stringg);
			if (!$lengthh || $lengthh < (int) $config['min_post_chars'])
			{
				$message_parser->warn_msg[] = (!$lengthh) ? $user->lang['TOO_FEW_CHARS'] : sprintf($user->lang['TOO_FEW_CHARS_LIMIT'], $lengthh, (int) $config['min_post_chars']);
			}
		}
Open inlcudes/message_parser.php (on line ~1100) find:

Code: Select all

if (!$message_length || $message_length < (int) $config['min_post_chars'])
Replace with:

Code: Select all

//Altered statement for replies only, choose the integer of your likings
if (!$message_length || $message_length < 3)
Set $config['min_post_chars'] to an amount of your likings (in admin panel) for creating a new topic.