PDA

View Full Version : exempt admin/mods from max characters in posts?


drives fast
03-23-2003, 07:51 PM
well...after much searching I haven't been able to find this

I have some team members that make very large posts with important information so I have to have my max characters at like 30,000

how would one be able to set that lower and make admin and mods exempt from that?

vb version 2.2.x

thanks for your help in advance

amykhar
03-23-2003, 08:11 PM
I believe this will do it for you. You might have to tinker a bit and I haven't tested it.

drives fast
03-23-2003, 08:28 PM
yea...I had already tried that but it didn't work

I am thinking it needs to look something like

if (strlen($message)>$postmaxchars and $postmaxchars!=0 and ($bbuserinfo[usergroupid]!=6) or ($bbuserinfo[usergroupid]!=5) or ($bbuserinfo[usergroupid]!=7)) {
eval("do what it is supposed to do")."\");");
}else{
eval("standarderror(\"".gettemplate("error_toolong")."\");");
}
granted I don't know what it is supposed to do and I am spit at php....lol

drives fast
03-23-2003, 10:38 PM
any other ideas?

I thank you for your help

Boofo
03-23-2003, 10:49 PM
if (strlen($message)>$postmaxchars and $postmaxchars!=0 and !in_array($bbuserinfo[usergroupid], array(5, 6, 7))) {
eval("do what it is supposed to do")."\");");
}else{
eval("standarderror(\"".gettemplate("error_toolong")."\");");
}

drives fast
03-23-2003, 10:51 PM
thank you but is this gonna work?
eval("do what it is supposed to do")."\");");
I just threw that in there cuz I didn't know what was supposed to go there

Boofo
03-23-2003, 11:09 PM
Just use what amy has in her file but change the first line to what I have.

drives fast
03-23-2003, 11:19 PM
okay...this is what I have in those two files now:
if (strlen($message)>$postmaxchars and $postmaxchars!=0 and !in_array($bbuserinfo[usergroupid], array(5, 6, 7))) {
eval("standarderror(\"".gettemplate("error_toolong")."\");");
}
but it still limits admin and mods

does it need the }else{ before the eval?

we'll sneak up on this booger yet :)

amykhar
03-23-2003, 11:23 PM
I just realized the problem with my code. The "Or"s need to be "And"s.

Amy

drives fast
03-24-2003, 01:09 AM
I tried it with "and" in place of the "or" and still doesn't allow team members to by-pass the limit

just a recap on what has been tried:

first tried this:
if (strlen($message)>$postmaxchars and $postmaxchars!=0 and ($bbuserinfo[usergroupid]!=6) or ($bbuserinfo[usergroupid]!=5) or ($bbuserinfo[usergroupid]!=7)) {
eval("standarderror(\"".gettemplate("error_toolong")."\");");
}
then tried this:
if (strlen($message)>$postmaxchars and $postmaxchars!=0 and !in_array($bbuserinfo[usergroupid], array(5, 6, 7))) {
eval("standarderror(\"".gettemplate("error_toolong")."\");");
}
then tried this:
if (strlen($message)>$postmaxchars and $postmaxchars!=0 and ($bbuserinfo[usergroupid]!=6) and ($bbuserinfo[usergroupid]!=5) and ($bbuserinfo[usergroupid]!=7)) {
eval("standarderror(\"".gettemplate("error_toolong")."\");");
}

with no results.

any other ideas?

drives fast
03-25-2003, 11:46 AM
okay...well...thanks for trying

WetWired
03-27-2003, 05:23 PM
I think the else was important. What you have at the end there is that only admins and mods get checked for long posts.

drives fast
03-27-2003, 09:54 PM
those were the suggestions I was given but I agree with you.

still hoping for a working solution.

amykhar
03-27-2003, 10:26 PM
Found it. The else isn't the problem. The code I have in the text file is fine. The problem is that there is a javascript in the newreply, editpost, and newthread templates.

Remove this code from them (or something similar in each. I am only looking at newreply)


if (postmaxchars != 0) { message = "\nThe maximum permitted length is $postmaxchars characters."; }
else { message = ""; }
alert("Your message is "+theform.message.value.length+" characters long."+message);

drives fast
03-28-2003, 02:30 AM
won't that disable the limit for everyone?

WetWired
03-28-2003, 09:20 PM
If you use this code you posted, it will still work for everyone else, but they won't be informed of their error 'till after their post hits the server.

if (strlen($message)>$postmaxchars and $postmaxchars!=0 and ($bbuserinfo[usergroupid]!=6) and ($bbuserinfo[usergroupid]!=5) and ($bbuserinfo[usergroupid]!=7)) {
eval("standarderror(\"".gettemplate("error_toolong")."\");");
}

amykhar
03-28-2003, 10:00 PM
If you really wanted you could create a separte newreply, newthread, editpost template for admins and mods that have the limit removed and then leave the javascript in for everybody else.

However, as the check is done on the server, it's really a matter of personal choice. I don't have a problem with users posting long posts; so this isn't an issue for me. You know where the code is and you know what your options are - you'll just have to decide what is best for you.

Amy

drives fast
03-29-2003, 12:02 AM
WetWired,

that code has alreay been tried and it limits the usergroups that are listed in it to the character limit instead of exempting them

amykhar
03-29-2003, 12:16 AM
No, it doesn't Drives Fast. They are exampted with that code on the server side. The reason it wasn't working was because the javascript was throwing the error before it ever got to the server.

You can't just throw any old code at your board and expect results. You need to start to understand how things work if you want to change the base functionality.

Amy

drives fast
03-29-2003, 01:07 AM
I am sorry but there is no such java script in my newthread nor newreply so the code mentioned does in fact prevent admins and mods from bypassing the limit. I looked for all of those words together and individually and did not find anything that looked anything like what you posted as the solution.

perhaps you are looking at a different version of vbulletin than I have

If I understood how vbulletin worked I wouldn't be asking for help on this.

If you no longer wish to help...then don't....but please do not insult me for no reason. The fact that I am asking for help is evidence enough that I do not know how to do this myself.

thank you anyway.....I give up