Minimum chars on new topic

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
olsserik
Registered User
Posts: 155
Joined: Tue Aug 21, 2007 6:18 am

Minimum chars on new topic

Post by olsserik »

Hi,

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

Thanks!
Last edited by olsserik on Thu Dec 22, 2016 1:35 pm, edited 1 time in total.
User avatar
KevC
Support Team Member
Support Team Member
Posts: 72616
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK

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

Post 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.
-:|:- Support Request Template -:|:-
Image
"Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb"
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs

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

Post by canonknipser »

KevC wrote:going to 3.1 and requesting an extension.
No need to request an extension, just install
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

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

Post by RMcGirr83 »

There is also the 3.0 MOD
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
olsserik
Registered User
Posts: 155
Joined: Tue Aug 21, 2007 6:18 am

Re: Minimum chars on new topic

Post by olsserik »

Thanks!
Last edited by olsserik on Thu Dec 22, 2016 1:36 pm, edited 1 time in total.
olsserik
Registered User
Posts: 155
Joined: Tue Aug 21, 2007 6:18 am

Re: Minimum chars on new topic

Post 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.

Return to “[3.0.x] Support Forum”