Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Updated Friday, February 20th, 2009 at 8:20pm

Specify the user level needed to skip comment moderation in WordPress

This simple WordPress hack allows you to specify the minimum user level needed to post comments without moderation. By default, WordPress allows administrators (and the author of the post) to skip moderation checks when posting comments, but it is easy to adjust this so that you can choose the user level yourself. This can be useful for those of you who have strict comment moderation enabled (manual comment approval), as it allows you to let registered users of your site post immediately without having to wait for approval.

Requirements

This code modification has been verified to work in WordPress versions 2.1 through 2.8+

Instructions

Open wp-includes/comment.php

For WordPress 2.1 through 2.7.x, Find the following code:

if ( $userdata && ( $user_id == $post_author || $user->has_cap('level_9') 
) ) {
  // The author and the admins get respect.
  $approved = 1;

For WordPress 2.8, Find the following code:

if ( isset($userdata) && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
  // The author and the admins get respect.
  $approved = 1;

Then simply change level_9 to whatever user level you want. All users at or above the selected level will be able to post comments without requiring manual approval (if you have manual approval enabled).

For a complete list of the user levels, and their roles, please see this page from the WordPress codex: http://codex.wordpress.org/Roles_and_Capabilities

  If you have found this page useful, please consider donating. Thanks!

Pages: [7] 6 5 4 3 2 1 » Show All

  1. 105
    vga to hdmi converter

    Your contributions, tools and insight are very helpful! I aware of this comment moderation adjustment within wordpress. Thanks for sharing!
    cbmassey

  2. Your eccentric use of the epistemology of desire betrays the influence of Pootwattle and his school, if a group so fractious and inherently quarrelsome may be said to constitute a school.

  3. 103
    Ultimate Directory

    I really love this page thanks for sharing your wonderful comments.
    file recovery software

  4. I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that……

  5. Enough informations have provided .We can get much news from this.Thank you for sharing. I figure that one learns something new everyday.

  6. Just wanted to say I think your scripts and plug-ins are great! Been using them for awhile now and have nothing but good things to say about them.

  7. I think we need to bring more ideas for this purpose. Involvement of young people can be handy in this regard. I am happy to find a good post here.

  8. Your contributions, tools and insight are very helpful! I aware of this comment moderation adjustment within wordpress. Thanks for sharing!

  9. Just wanted to say I think your scripts and plug-ins are great! Been using them for awhile now and have nothing but good things to say about them. Thanks for providing such great and useful tools! Looking for carpal tunnel relief treatments?

  10. I wasn’t interested in academics so left school early to study graphic design, then when I graduated, my first job was with a motion design company.

  11. That is a major goal of this project: To share the true history of the foundation of our own cultural past.

  12. Interesting publication first of all. Actually I was looking for this information for a long time and finally have noticed this your entry.

  13. My 2 year old son has been in the hospital for bilateral pleural chylous effusions since Jan 29, p/o Fontan in November of 2009.

  14. Taken together, it’s a lot to pay off without a physician’s salary, whether someone plans on working or going into another professional program.

  15. 91
    Exclusive Sites

    I really love this page thanks for sharing your wonderful comments.
    Workers Compensatio

Pages: [7] 6 5 4 3 2 1 » Show All

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.