Skip to:
Content
Pages
Categories
Search
Top
Bottom

Limiting my forum’s post size


  • michael3185
    Member

    @michael3185

    I’ve had a good hunt around, but am not sure if I’m in wood-for-trees mode on this one.

    Is there a way to limit the size of posts people can make? I’ve set up a new forum, where some members may join via another forum we belong to. Some of them make posts there of pages and pages of text. Can I limit posts to say, 3000 characters?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You have 2 options.

    1. Limit it on the client side using JavaScript

    2. Limit it on the server side using PHP.

    If you limit it on the client side, it’ll be the easiest to implement but if the person turns off JavaScript in there browser – the person will still be able to post greater than 3000 characters.

    If you choice option 1, you’ll want to create some type of “maxlength” functionality for the TEXTAREA attribute in the post-form.php.

    I haven’t used it but you’ll want to use something simply like:

    http://www.javascriptbank.com/javascript/form/validation-limitation/textarea-maxlength/detail/

    Untested thought: You could edit your theme to limit the data accepted in the textbox.

    http://www.hscripts.com/scripts/JavaScript/character-count.php


    michael3185
    Member

    @michael3185

    Thanks for the link Ipstenu. I guess I wasn’t thinking along the right lines, as it needs to be done in the browser, not on the bbPress PHP side. I’m not sure how to implement that JavaScript and HTML code, but I’ll give it a go sometime soon. It’d be nice if the CSS TextArea had a setting for that, wouldn’t it?


    chrishajer
    Participant

    @chrishajer

    Just a note: that field length can be bypassed in the browser, if someone wants to. If you don’t modify the database field, it probably won’t be a problem and it will prevent people from just posting things that are too long. I think a better way would be to verify that the input is less than 3000 characters with a plugin, before trying to insert it into the database.

    Maybe a combination of the two. Give people a counter showing how many characters are left (like eBay does in some of their forms) and then have a plugin verify what is being submitted actually conforms to your rules.

    CSS doesn’t control everything. Yet. ;) Actually, it can control that, but not reliably or consistently, due to browser independence.

    chris’s idea is probably best in the long run.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar