I have set the limit for characters to be used in a title to 30. That works fine as long as users are actually typing it, but since I get a lot of submissions with titles MUCH longer than that there must be a way around it. I managed to do it by pasting longer titles in the form as well as using the META tag button. Unlike the textarea field for the description the input field for the title doesn't seem to cut back the characters that are over the limit automatically once you click on the field.
So I was thinking I could limit the title output instead. It might not be pretty in some cases, but people will get the point and maybe edit their titles to make them shorter.
I tried something like this, but it's been either producing errors or returning a blank title:
<?php global $title; $titlenew = substr($title, 0, 30); ?>
The beforeaddition plugin could trim it ($object->title = substr($object->title, 0, 30);), but I'll just make it standard. Currently if a spammer submits the form by an automated method it doesn't trim it.
0/5
1
2
3
4
5
Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.
Comments on Limiting title characters the hard way
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
I have set the limit for characters to be used in a title to 30. That works fine as long as users are actually typing it, but since I get a lot of submissions with titles MUCH longer than that there must be a way around it. I managed to do it by pasting longer titles in the form as well as using the META tag button. Unlike the textarea field for the description the input field for the title doesn't seem to cut back the characters that are over the limit automatically once you click on the field.
So I was thinking I could limit the title output instead. It might not be pretty in some cases, but people will get the point and maybe edit their titles to make them shorter.
I tried something like this, but it's been either producing errors or returning a blank title:
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
The beforeaddition plugin could trim it ($object->title = substr($object->title, 0, 30);), but I'll just make it standard. Currently if a spammer submits the form by an automated method it doesn't trim it.