Support » Plugin: Limit Comments and Word Count » When Duplicated Comments = redirects to wp-comments-post.php

  • Resolved JJNW

    (@jjnw)


    Hello. When testing, I placed multiple comments in and got a redirect url to http://127.0.0.1/web/wp-comments-post.php (my local server, developing website).

    This redirect gives me a very simple, white page and states, “Duplicate comment detected; it looks as though you’ve already said that!”

    Is there a way for that comment to just show up on the same page the form was submitted (error message, popup message, etc.)?

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author artiosmedia

    (@artiosmedia)

    @jjnw Sorry, just now seeing your request. WordPress notices are not delivering to our emails. We are looking into your request as an update. Thanks.

    JJNW

    (@jjnw)

    All good in the hood; I fixed the problem by placing these bits of goodies in my functions.php file.

    
    // START REMOVE Duplicate Comments
    function enable_duplicate_comments_preprocess_comment($comment_data)
    {
    	//add some random content to comment to keep dupe checker from finding it
    	$random = md5(time());	
    	$comment_data['comment_content'] .= "disabledupes{" . $random . "}disabledupes";	
    	
    	return $comment_data;
    }
    add_filter('preprocess_comment', 'enable_duplicate_comments_preprocess_comment');
    
    function enable_duplicate_comments_comment_post($comment_id)
    {
    	global $wpdb;
    	
    	//remove the random content
    	$comment_content = $wpdb->get_var("SELECT comment_content FROM $wpdb->comments WHERE comment_ID = '$comment_id' LIMIT 1");	
    	$comment_content = preg_replace("/disabledupes{.*}disabledupes/", "", $comment_content);
    	$wpdb->query("UPDATE $wpdb->comments SET comment_content = '" . $wpdb->escape($comment_content) . "' WHERE comment_ID = '$comment_id' LIMIT 1");
    		
    	/*
    		add your own dupe checker here if you want
    	*/
    }
    add_action('comment_post', 'enable_duplicate_comments_comment_post');
    // END STOP Duplicate comments
    

    And to remove flood protection I added this too, to functions.php file.

    
    // START stop Going Too Fast on comments
    add_filter('comment_flood_filter', '__return_false');
    // END stop Going Too Fast on comments
    

    No biggie biggie two by four, because I have other code limiting users to 6 comments a day, plus a flagging system to help moderate the sitiation (yeah, say that like an old gangster Ahahahah).

    JJ

    Plugin Author artiosmedia

    (@artiosmedia)

    Your code sharing and tips are very helpful, @jjnw. Can you share the code and outline of the flagging system? Is the feature an addition we should consider? Maybe you have enough coding experience to make these plugin modifications and additions to the plugin and share it back with me for user distribution? I have wanted to add a radio box to settings panel “Disable Flood Protection Notice” above the “Save Changes” button, below the settings table as an option to click if someone want’s that feature disabled.

    Please do leave a plugin review, where this a 100% not-for-profit venture for the homeless and hungry. I spend money developing these plugins, but don’t make a penny personally 🙂 Thanks!

    JJNW

    (@jjnw)

    The flagging / moderation system… give a few to think… Flagged Content Pro I bought on CodeCanyon.net for a couple of bucks. Originally on WordPress as Flagged Content, but either isn’t supported anymore – though I have no problems with it using WP 5.2.5 PHP 7.3.5 (of course every environment is different).

    Here is the free version on WordPress, and I just noticed in support the developer did respond to a support request several months ago (so he still alive):

    Flagged Content

    PS again, Pro version works fine for my use WP 5.2.5 PHP 7.3.5 = no php errors, no system notices, etc.

    JJ

    Quick update: ignore ALL that crazy code I originally suggested earlier: here is a much, much, much cleaner alternative I am using (and tested):

    
    // START REMOVE Duplicate COmments
    add_filter('duplicate_comment_id', '__return_false');
    //
    // END REMOVE Duplicate comments
    //
    // START stop Going Too Fast on comments
    //
    add_filter('comment_flood_filter', '__return_false');
    //
    // END stop Going Too Fast on comments
    
    • This reply was modified 1 month, 4 weeks ago by JJNW.
    Plugin Author artiosmedia

    (@artiosmedia)

    Hello @jjnw. We have updated to version 1.0.7. On the settings panel you will find two added functions. A) Disable Flood Protection Notice and B) Allow Duplicate Comments. With these checked, you should be able to delete your customizations in functions.php file. If there are any problems with these setting, please let me know! Thanks.

    Excellent, thank you!

    • This reply was modified 1 month, 3 weeks ago by JJNW.
    Plugin Author artiosmedia

    (@artiosmedia)

    @jjnw Please, please leave a review, where I very work hard and pay too much for my plugins but rarely see gratitude. https://wordpress.org/support/plugin/limit-comments-and-word-count/reviews/ Thanks!

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