Change how many approved comments must user have

You could try the pre_comment_approved filter to modify the approval status for the $approved = 1 case, excluding the post author and users with moderate_comments capability. Then set it to 0 if the commenter has fewer than 2 approved comments. Note that the approved value can also be ‘spam’ or ‘trash’.

Get return value of wp_insert_comment (comment ID)

wp_insert_comment is both a hook and a function. Once a comment is left on your blog, this action hook will be triggered, allowing you to modify the comment. A very simple example would be: add_action(‘wp_insert_comment’,’my_function’,100,2); function my_function($comment_id, $comment_object) { // Now you have access to $comment_id, save it, print it, do whatever you want with … Read more

Ajax comment form submit on frontpage alerts success but no insertion

It took a while, but this works (a comment is created, albeit with still some missing values, but fixing that part is easy) Biggest changes: For some reason an ‘echo’ in functions.php was important. Also, I changed the ‘action’ in ajaxtry2.js under data: HTML (values are fictional) <form id=”commentform” class=”commentform”> <label for=”comment”></label> <textarea id=”comment” class=”comment” … Read more

How to get all comment authors of a single post?

Writing a loop and going through every comment is the option that I can offer you. Take a look at this example: function get_comment_authors($post_ID){ // Get every comment on this post $args = array( ‘post_id’ => $post_ID ); $comment_objects = get_comments( $args ); // Define an empty array to store the comments $author_array = array(); … Read more