WordPress.org

Ready to get started?Download WordPress

Forums

Simple Comment Editing
[resolved] Comment Length Restriction (4 posts)

  1. KatieKat
    Member
    Posted 8 months ago #

    Hi,
    this is a brilliant plugin and very worthy of my 5 star review.

    Hope this is a simple query.

    I have a minimum comment length of 50 characters in my functions.php file but have noticed that when editing a comment it is not picking up the restriction and the user is able to edit a comment to less than 50 characters. Is there any way of forcing a user to make a comment of more than 50 characters when editing a comment.

    Kind Regards

    KatieKat

    http://wordpress.org/plugins/simple-comment-editing/

  2. Ronald Huereca
    Member
    Plugin Author

    Posted 8 months ago #

    KatieKat,

    Thank you for the wonderful plugin compliment.

    Unfortunately there isn't currently a way in the plugin to make the 50 characters a requirement. I'll consider adding some filters that can have custom error messages so additional checks can be placed on Ajax-submitted comments.

    For now, I'm considering this a feature request.

    Thanks again so much for the rating and kind words.

  3. KatieKat
    Member
    Posted 7 months ago #

    Hi Ronald,
    not sure if this helps but I am using this at the moment to control the comment length obviously without the edit but do not have enough technical experience to understand how to implement with your plugin.

    add_filter( 'preprocess_comment', 'minimal_comment_length' );

    function minimal_comment_length( $commentdata ) {
    $minimalCommentLength = 50;

    if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength )
    {
    wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' );
    }
    return $commentdata;
    }

  4. KatieKat
    Member
    Posted 7 months ago #

    Please note this is not my own code but has come from the website below.

    http://www.bwidgets.com/2013/11/how-to-set-minimum-comment-length-in.html

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.