PDA

View Full Version : [req] Min, word count to submit post [/req]


Mathiau
10-17-2002, 07:05 PM
Hey all

Was curious, if someone has any free time, pending on how simple this would be

To make a hack were there has to be a minimum amount of words / characters in a reply, before it can be posted?

So lets say you have to post 30 characters or more, if you don't, when you try to post that reply, you will be told,

"sorry, your post has to have at least 30 characters"

or something like that...?

Xenon
10-17-2002, 07:20 PM
shouldnt be very hard (at least the char counter):

open newreply.php

find $title=censortext($title);
$message=censortext($message);


below add:

if(strlen($message)<30) {
eval("standarderror(\"Your message is too short!\");");
exit;
}

Erwin
10-17-2002, 07:29 PM
Or instead of letting the message go through and redirect to the error template, you can modify the javascript in the template that checks the message length by adding this:


if (postmaxchars != 0) {
if (theform.message.value.length < 30) {
alert("Your message is too short.\n\nIncrease your message to 5.\nIt is currently "+theform.message.value.length+" characters long.");
return false; }
else { return true; }
} else { return true; }
}


Untested, but should work. Advantage is that a message pops up if the post is too short (just like if it's too long) instead of redirecting the whole page. Disadvantage is that you have to change the code in newreply, newthread and quickreply. :)

Xenon
10-17-2002, 08:02 PM
anotzher disadvantage is that some which haven't enabled javascript won't see that ;)

my code works for all users

Erwin
10-17-2002, 08:10 PM
Originally posted by Xenon
anotzher disadvantage is that some which haven't enabled javascript won't see that ;)

my code works for all users

True. Maybe a combination of the 2 then. :) Isn't that how the max char allowed works?

Xenon
10-18-2002, 12:12 PM
yes, you're right, the combination is used for maxchars too :)

and yes a combination would be best ;)

Mathiau
10-18-2002, 01:51 PM
^^^^

sweet guys!, okay, shall try this out :)

Mathiau
11-20-2002, 03:10 PM
Hey guys

is there any special way i should put both of them together? or just copy and paste one after the other?

Also where exactly should i paste this code?

Xenon
11-20-2002, 03:17 PM
well, copy and paste them one after th other is impossible.

my change is a codechange to newreply.php
erwins instead is a change of the newreply template

Mathiau
11-21-2002, 05:23 AM
AHAH okay ke kew - so just put each in it's correct template / file :)

easy enough! althought knowing me i will be back..lol

Julio
11-21-2002, 12:02 PM
Mathiau:

Please let us kow if it works for you using both mods.

a) PHP mod

and

b) Template mod

Mathiau
11-22-2002, 12:07 AM
Originally posted by Xenon
well, copy and paste them one after th other is impossible.

my change is a codechange to newreply.php
erwins instead is a change of the newreply template


well, i put yours in, but it did not seem to stop anything with less then 15 characters in it, :( - changed it to 15 from 30


also - erwin or Xenon - where exactly should i paste his code in the newreply template?

Xenon
11-22-2002, 11:27 AM
hmm, the code is corect, it should work.
have you uploaded the file correctly?

also have you tested it in a thread?
it won't work for creating new threads, because there you have to edit newthread.php

Mathiau
11-23-2002, 05:34 AM
ahaha

silly me! i was doing a new thread! it works :) - going to the next page - so trying the pop up code now so i got em both in.

Do u by chance know where i need to paste Eriwins code...?

Xenon
11-23-2002, 09:52 AM
ahh :)

hmm, just know somewhere in the javascript code where messagelenght is checked, but can't tell more, i'm a javascript noob ;)

kmfdm_kid2000
11-23-2002, 11:23 AM
This one works well, I have it installed and it's very simple...

https://vborg.vbsupport.ru/showthread.php?s=&threadid=42686

Mathiau
11-23-2002, 04:27 PM
^^^

but does that one pop up a window or go to a new page?

i have the on that goes to a new page - thnx Xenon. now it would be kew to have the pop up window one as well incase this way who ever has java can use it and those who don't will see Xenon's one