Guys please help me to create this simple plugin. I need to throw a hook to newthread.php and add a simple conditional that will check message length.
if message length +200 then do nothing else error
Create a file in your plugins folder named threadlimit.php and paste the following code, and activate via ACP
<?php
if(!defined("IN_MYBB"))
exit;
$plugins->add_hook("newthread_do_newthread_start", "threadlimit_run");
function threadlimit_info()
{
return array(
'name' => 'Thread Message Length',
'description' => 'Only allow threads to be posted if they\'re under a certain length',
'website' => '',
'author' => 'Mattbox Solutions',
'authorsite' => '',
'version' => '1.0',
'guid' => '',
'compatibility' => '*'
);
}
function threadlimit_run()
{
global $mybb;
$minimum_characters = 200; // Edit number of minimum characters here
$chars = strlen($mybb->input['message']);
if ($chars < $minimum_characters)
error('Your thread message must contain a minimum of ' . $minimum_characters . ' characters to continue. It currently is ' . $chars . ' characters.');
}
?>
Very Dear @ectomatt thank your so much I really appreciate time you took to to create this plugin.
Is there a way to also add title characters check?
$title_chars
and please could you also add a hook to editpost.php
(2014-01-09, 11:36 AM)marcus123 Wrote: [ -> ]Very Dear @ectomatt thank your so much I really appreciate time you took to to create this plugin.
Is there a way to also add title characters check?
$title_chars
and please could you also add a hook to editpost.php
Please go into a bit more detail on what you mean when you say "title characters check" and yes, I'll add it so it checks when editing the thread too
I have used your plugin and it works great but could you please make it also check TITLE and how to show error messages on the same page I am referring to "inline_error function"
And please make it also work with editpost.php not only with newthread.php
Thanks very much