Minimum Character Limit MOD for 3.0.1

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Minimum Character Limit MOD for 3.0.1

Post by Mike9824 »

I was wondering if someone could make a minimum character limit MOD for version 3.0.1 because the only one I know of is for 2.0.0 - 2.0.6

So basically I would like a MOD where you are able to set a minimum character limit for posts (so users would have to make a certain amount of characters in their post before they can post it) and to have to ability to edit the error message they get when they don't reach the limit.

Edit: I no longer need the MOD that enables BBcode in word censors.

Also I would like a MOD that enables BBcode in Word Censors, I know there is one out there (http://www.phpbb.com/community/viewtopi ... &sk=t&sd=a)

However that is for version 3.0.0 and not 3.0.1.
Last edited by Mike9824 on Wed Apr 30, 2008 1:51 am, edited 2 times in total.

SamSPZ1
Registered User
Posts: 4
Joined: Tue Apr 22, 2008 2:10 am

Re: Minimum Character Limit & BBCode in Word Censor for 3.0.1

Post by SamSPZ1 »

Yeah, I really need this for my forum also. Can anyone supply us with one?

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit & BBCode in Word Censor for 3.0.1

Post by Mike9824 »

Nevermind the Word Censor one, I found out that it is for 3.0.1 however I still need the minimum character limit MOD.

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit & BBCode in Word Censor for 3.0.1

Post by Mike9824 »

Can someone please help me out, I really need the minimum character limit MOD for 3.0.1

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by Mike9824 »

Please can someone help me out here, I have been waiting for a very long time and the only response I have gotten in this thread was from someone else saying that they needed it.

DJ Skitzo
Registered User
Posts: 596
Joined: Sun Aug 12, 2007 7:25 pm

Re: Minimum Character Limit MOD for 3.0.1

Post by DJ Skitzo »

I really need this aswell

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by Mike9824 »

Can someone please make this?

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by Mike9824 »

Someone please make this MOD. I have been waiting a very long time and this thread just keeps getting off the first page.

tommekemc
Registered User
Posts: 457
Joined: Wed May 14, 2008 6:36 pm
Location: Belgium
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by tommekemc »

I'm making it now :)
if you can supply me with the 2.X link I'dd be able to make it faster.
I found out: when a user posts a message, a function is asked for in 'includes/functions_posting.php': submit_post
I suppose I'dd add the stringlength before the code where submit_post is asked.

SQL

Code: Select all

INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_post_chars', '0');
in "includes\acp\acp_board.php":
find:

Code: Select all

						'max_post_chars'		=> array('lang' => 'CHAR_LIMIT',			'validate' => 'int:0',	'type' => 'text:4:6', 'explain' => true),
add after:

Code: Select all

						'min_post_chars'		=> array('lang' => 'MIN_CHAR_LIMIT',			'validate' => 'int:0',	'type' => 'text:4:6', 'explain' => true),
in "language\en\acp\board.php":
find:

Code: Select all

	'CHAR_LIMIT_EXPLAIN'			=> 'The number of characters allowed within a post. Set to 0 for unlimited characters.',
add after:

Code: Select all

	'MIN_CHAR_LIMIT'				=> 'Minimum characters per post',
	'MIN_CHAR_LIMIT_EXPLAIN'		=> 'the minimum number of characters within a post, set to 0 if you don\'t want any limit.',
in "includes/functions_posting.php"
find:

Code: Select all

?>
add before:

Code: Select all

/*--------------------------------------------
mod: minimum char limit
--------------------------------------------*/
postlength_big_enough($the_subject_to_check){
	$theMinimumAmount=mysql_query("SELECT config_value FROM phpbb_config WHERE config_name='min_post_chars'");
	$theMinimumAmount=mysql_fetch_row($theMinimumAmount);
	if(strlen($the_subject_to_check)<$theMinimumAmount){
		return true;
	}else{
		return false;
	}
}
/*--------------------------------------------
mod: minimum char limit
--------------------------------------------*/
in "posting.php"
find:

Code: Select all

			// If the post need approval we will wait a lot longer.
add after:

Code: Select all

			/*--------------------------------------------
			mod: minimum char limit
			--------------------------------------------*/
			if(postlength_big_enough($data['message'])){
			/*--------------------------------------------
			end mod: minimum char limit
			--------------------------------------------*/
find:

Code: Select all

			$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $data['forum_id']) . '">', '</a>');
			trigger_error($message);
add after:

Code: Select all

			/*--------------------------------------------
			mod: minimum char limit
			--------------------------------------------*/}else{
			$message .= '<br /><br />The message is too short, it should contain a minimum of '.$minimum_characters_mod.' characters.');
			trigger_error($message);
			/*--------------------------------------------
			end mod: minimum char limit
			--------------------------------------------*/

this should do the trick:)
don't forget to purge the cache!
Last edited by tommekemc on Fri May 23, 2008 3:01 pm, edited 1 time in total.
my sig
my projects

images deleted because of the 6kb (wtf?) rule...

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by Mike9824 »

^ I couldn't find

Code: Select all

language\en\board.php
in the forum files.

Also here are links to previous versions of phpBB:

2.0.0 - 2.0.6: http://www.phpbbhacks.com/download/1681
3.0.0: http://www.phpbb.com/community/viewtopi ... &p=5005395

tommekemc
Registered User
Posts: 457
Joined: Wed May 14, 2008 6:36 pm
Location: Belgium
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by tommekemc »

the language file was linked wrong, solved this :)
my sig
my projects

images deleted because of the 6kb (wtf?) rule...

Levicious
Registered User
Posts: 32
Joined: Fri Apr 18, 2008 4:01 pm

Re: Minimum Character Limit MOD for 3.0.1

Post by Levicious »

Gonna try this out , need this mod asswel !

Edit : not working for me ..
Gonna search another mod

User avatar
parasolx
Registered User
Posts: 146
Joined: Wed Apr 23, 2008 8:52 am
Location: Malaysia
Name: Hadafi

Re: Minimum Character Limit MOD for 3.0.1

Post by parasolx »

Here is the working Minimum Character Limit MOD for 3.0.1. I have combined between two script and it works very nice in my live forum. Here is the MOD. Hope get any issues and comment from all.

SQL

Code: Select all

INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_post_chars', '0');
in "includes\acp\acp_board.php":
find:

Code: Select all

                      'max_post_chars'      => array('lang' => 'CHAR_LIMIT',         'validate' => 'int:0',   'type' => 'text:4:6', 'explain' => true),
add after:

Code: Select all

                      'min_post_chars'      => array('lang' => 'MIN_CHAR_LIMIT',         'validate' => 'int:0',   'type' => 'text:4:6', 'explain' => true),
in "language\en\acp\board.php":
find:

Code: Select all

   'CHAR_LIMIT_EXPLAIN'         => 'The number of characters allowed within a post. Set to 0 for unlimited characters.',
add after:

Code: Select all

       'MIN_CHAR_LIMIT'            => 'Minimum characters per post',
       'MIN_CHAR_LIMIT_EXPLAIN'      => 'the minimum number of characters within a post, set to 0 if you don\'t want any limit.',
in "includes/message_parser.php":
find:

Code: Select all

      // Check for "empty" message
      if ($mode !== 'sig' && !utf8_clean_string($this->message))
      {
         $this->warn_msg[] = $user->lang['TOO_FEW_CHARS'];
         return $this->warn_msg;
      }
add after:

Code: Select all

      // Check for character limit
	  $sql = "SELECT config_value
	   		FROM phpbb_config
				WHERE config_name = 'min_post_chars'";
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
			$min_post_chars = $row['config_value'];
		$db->sql_freeresult($result);

      if ($mode !== 'sig' && strlen(utf8_clean_string($this->message)) < $min_post_chars)
      {
         $this->warn_msg[] = $user->lang['TOO_FEW_CHARS_POST'] . $min_post_chars . $user->lang['CHAR_LENGTH'];
         return $this->warn_msg;
      }
in "language/en/posting.php":
find:

Code: Select all

   'TOO_FEW_CHARS'            => 'Your message contains too few characters.',
add after:

Code: Select all

    'TOO_FEW_CHARS_POST'      	=> 'Your message contains too few characters. The message must be at least ',
	'CHAR_LENGTH'				=> ' character length.',
Save and upload all edited files. Purge your cache. Set your minimum character needed before post in ACP >> General >> Board Configuration >> Post Setting. Then... walla... it should be like this if you have make it right:
Image

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by Mike9824 »

Thanks parasolx it worked! :)

Mike9824
Registered User
Posts: 153
Joined: Sun Apr 20, 2008 5:39 am
Name: Mike Goldman
Contact:

Re: Minimum Character Limit MOD for 3.0.1

Post by Mike9824 »

Is there a way to make it so a quote wont count as part of the characters?

Locked

Return to “[3.0.x] MOD Requests”