Skip to:

Groups: How to limit max length of posts and replies.

  • grimbot


    Hello, I’ve looked around a bit but couldn’t find a code or plugin that would allow me to limit the character length of a post in the buddypress groups. I’m not looking for a read more option, or excerpt option, or even a warning that the post was too long and to shorten it, just truncate it.

    If the limit is set to 143 characters, I’d like for any extra text to be chopped off with no warning or to have them just not be able to continue entering text.

    Thanks for sharing your answers.

Viewing 1 replies (of 1 total)
  • Super easy solution is to do like this:

    1) find or create a buddypress/activity/post-form.php file in your theme
    2) find in that file a textarea with id="whats-new" and add maxlength="143" to its attributes so it will become something like this:
    <textarea class="bp-suggestions" maxlength="143" name="whats-new" id="whats-new" cols="50" rows="10"....
    3) save and done.

    It will limit globally, though. If only in groups (not modifiying activity directory and profiles) – wrap it in a p_is_group() like this
    <textarea class="bp-suggestions" <?php echo bp_is_group() ? 'maxlength="143"' : '';?> name="whats-new" id="whats-new" cols="50" rows="10"....

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