I wrote the code for three first comments to be moderated, if someone interested.
Code below, and to be added to functions.php
add_filter('pre_comment_approved', 'moderate_commentator', 10, 2);
function moderate_commentator( $approved, $commentdata ){
$args = array(
'user_id' => $commentdata['user_ID'], //get user_ID of the commnet author
'status' => 'approve', //approved comments only
'count' => true //return only the count
);
$comments = get_comments( $args );
$comments_Num = 3; // number of comments to moderate
if( $comments < $comments_Num )
$approved = 0; // set - comment is marked for moderation as "Pending" if less than 3 comments approved
return $approved;
}
Any chance to optimmize the code? or is already optimal?
thanks
Related Posts:
- How do I comment out a block of tags in XML?
- How to enable comments for pending and draft posts?
- A plugin where users can comment with Facebook or Twitter or OpenID [closed]
- Reverse comment pagination numbers
- Comment Count for each Comment Author
- Show comments from multiple post IDs in comment template
- get recent comments of a particular category
- Sticky Comments
- Whitelisting Commenters
- WP_Comment_Query() displays “password protected” comments?
- Comments number message in password protected post
- Disable Comments Feed
- Use rich text editor in comments?
- Add a custom class to awating comments
- How to add custom comment fields but *only on the comment reply form*?
- Is it possible to move a comment that should be a reply to another comment?
- Can I seperate comments from post?
- Show only posts which can be commented
- What should I hook to add extra fields to comments?
- Get a variable field of all comments of current post
- Average Score of all ratings in comments
- Making a Comment on a page without being on that page?
- Display commenter’s registration date on comments?
- How do I display the commentor’s first name and last name in the comments?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, func
- How To Disable Comments On New Page
- What is the server IP comment hack
- How to add consent checkbox in comment section
- Do I have to have a nonce for a custom comment field?
- Get last seen date/time in wordpress get_comments() [closed]
- WP 4.4.1 allow empty comments via add_action ‘pre_comment_on_post’
- Report spam button
- Recent comments from my blogs only
- Share comment to twitter after publishing [closed]
- changing comment-page-# to something like review-page-#
- Change username to nickname in comment section
- Hide notifications regarding new comments
- Are there any “YouTube-styled” commenting systems for WordPress?
- how to change comment author’s link from user’s website to author’s page(author.php)?
- Add class to comment form div when comment-reply button is clicked
- Add filter to comments loop?
- Disabling archives, search results, comments, etc?
- Pagination Comments Doesn’t Show
- Show comments to unregistered users
- WordPress comments – how to check if comment still needs to be approved?
- PAIN. Comments Pagination
- How to retain comment text on comment form after login/registration?
- Adding character count and limit in comments, modifying labels and fields – jetpack
- Check if comment was successfully submited
- Troubleshooting Emoji in Comments
- Change id=”respond” to the comments container
- Comments on Author page
- Why could my comment_form variable not be working?
- How to block comments and pings?
- Woocommerce comments subscription [closed]
- Can I turn off further comments on a single page?
- How to remove the number of a comment in the url slug?
- How to tweak comment fields properly from functions.php
- Advanced Custom Fields comments [closed]
- How are readers authenticated for leaving comments?
- Are there some caveats for using guids for FB comments
- How to wrap comment_form $fields in one div?
- Two textareas showing up in comments.php
- How can I grab and show the reader comments of my site
- Make email not required comments.php
- My posts show 2 comment forms
- how should the comment form really work?
- Thesis Theme Custom Loop
- Sync comments between two WP installs
- Show image next to the comment author if have certain role
- create separate page template for wordpress comments
- Styling Admin comments in WP 3.1.3
- How t Remove Labels from comment Box
- SQL command to delete “pending comments” doesn’t work…?
- How to rename/change the comment labels in WordPress backend?
- How to remove a span class?
- Upload avatar for post comment
- How can I enable comments on category page but not home page?
- Comments stuck inside post edit, but not showing under the published posts
- wp_mail doesnt work inside transition_comment_status
- How add custom text under comment form
- Badges for Guests based on their comment counts [closed]
- How to add a class to comment submit button?
- WordPress Commenting System User access and Security
- Comments.php is not getting called on main blog page
- Allowing comments on author pages
- WordPress Comments – Only show part of user name
- Broken comments section – WordPress 2014 Theme
- Need an advice about comments
- I want to fill the comment with the comment count?
- How do I get the comments section to show up?
- By Default, Turn Comments Off for Pages & Leave Comments On for Posts
- same comment list for two posts
- Replace do_action() with a normal submit form in comments.php
- edit-comments.php in Admin – how to change ‘Comments’ title?
- Comments on pages not appearing, even though I enabled them
- Stop future commenting on specific post
- comment awaiting moderation
- How do you fetch the authors email or IP from /comments? (REST API)
- WordPress Editor widgets “comments” and “post comments form” getting disappeared with elementor [closed]