PDA

View Full Version : Preventing all caps in message?


Cold Steel
04-21-2002, 11:32 AM
Has this been done yet? I did a search for "caps" and this didn't turn up.

I have one member who has her caps lock permanently on, and it's annoying.

Is there some way to turn it off, from my end?

Scott MacVicar
04-21-2002, 12:36 PM
go to you vBulletin admin panel then into vBulletin Options you need to then click the [Thread display options] options link and turn Stop 'Shouting' in titles to Yes.

Admin
04-21-2002, 12:46 PM
And if you want to do that for the whole message, add this code:
if ($bbcode == strtoupper($bbcode)) {
$bbcode = ucwords(strtolower($bbcode));
}
In functions.php right after this:
$dobbcode=$forum[allowbbcode];
}

Sparkz
04-21-2002, 01:07 PM
And to make only the first letter of a sentence uppercase you could change this:

if ($bbcode == strtoupper($bbcode)) {
$bbcode = ucwords(strtolower($bbcode));
}


to something like this:

if ($bbcode == strtoupper($bbcode)) {
$bbarr = explode ('.', $bbcode);
$bbcode = "";
foreach ($bbarr as $bbsentence) {
$bbcode .= ucwords(strtolower($bbsentence));
}
}


Untested...

Admin
04-21-2002, 01:20 PM
Nope, that won't work Sparkz. :) And it will also remove all the "." from it.

Admin
04-21-2002, 02:14 PM
BTW you can use ucfirst() instead of ucwords() to get the first character capitalized (in the text, not the first in each sentence).

Cold Steel
04-22-2002, 12:40 AM
Thanks FireFly.

Now "ONE TWO THREE" looks like "One Two Three." I'd rather have it all lowercase... is that possible?

Sparkz
04-22-2002, 10:43 AM
if ($bbcode == strtoupper($bbcode)) {
$bbarr = explode ('.', $bbcode);
$bbcode = "";
foreach ($bbarr as $bbsentence) {
$bbcode .= ucfirst(strtolower(ltrim($bbsentence))) . ".";
}
}


Try this. You'll lose all whitespace in the beginning of the sentences, ie "THIS IS CAPS. THIS IS CAPS" will become "This is caps.This is caps"

Sparkz
04-22-2002, 10:45 AM
Originally posted by FireFly
BTW you can use ucfirst() instead of ucwords() to get the first character capitalized (in the text, not the first in each sentence).

lol, I was obviously going to use ucfirst() in my first attempt, but forgot to change it (I copy'n'pasted your code. To lazy to write it out by hand :P )

Cold Steel
04-22-2002, 03:54 PM
Thanks Sparkz! I can deal with the lack of whitespace, but the code also adds an extra period at the end. Is there anything that can be done about that?

Sparkz
04-22-2002, 04:06 PM
if ($bbcode == strtoupper($bbcode)) {
$bbarr = explode ('.', $bbcode);
$bbcode = "";
foreach ($bbarr as $bbsentence) {
if (trim($bbsentence) != "") {
$bbcode .= ucfirst(strtolower(ltrim($bbsentence))) . ".";
}
}
}


It only happened if the last letter of the text was a period.
I guess that's what you get for not testing your code properly :)
That should do it.

flasvt
08-27-2002, 01:22 AM
A lot of my smile codes have upper and lower case letters. If you have all caps in the words and then add a smile that has a lower case letter, then nothing is changed. If you add a smile that has only upper case letters, everything gets converted but then the smile doesn't work. All of my smile codes start with a " : ". Is there a way to modify this so that is will ignore the smile codes?