Skip to:
Content
Pages
Categories
Search
Top
Bottom

Character Count


  • jemar707
    Participant

    @jemar707

    Any snippets around to drop into functions and limit the character count in replies and topics?

Viewing 5 replies - 1 through 5 (of 5 total)

  • Robin W
    Moderator

    @robin-w

    I don’t know how technical you are, this one does the opposite

    function rew_min_length ($reply_content) {
    	if (strlen($reply_content)<61) {
    		bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply must be at least 60 characters.', 'bbpress' ) );
    	}
    return $reply_content ;
    }
    
    add_filter( 'bbp_new_reply_pre_content', 'rew_min_length' );

    jemar707
    Participant

    @jemar707

    Thanks! I will see if I can play with that. My first guess is just changing <61 to >500


    jemar707
    Participant

    @jemar707

    I tried to post as code….will try again. But this didn’t work.

    function rew_max_length ($reply_content) {
    	if (strlen($reply_content)<500) {
    		bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply must be less than 500 characters.', 'bbpress' ) );
    	}
    return $reply_content ;
    }
    
    add_filter( 'bbp_new_reply_pre_content', 'rew_max_length' );

    Robin W
    Moderator

    @robin-w

    try >500 not <500


    jemar707
    Participant

    @jemar707

    Ok that worked to stop the ability to submit, but didn’t print the error message.

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