WordPress.org

Ready to get started?Download WordPress

Forums

Do I have to approve my own comments? (11 posts)

  1. moshu
    Member
    Posted 9 years ago #

    WP 1.5 in testbed.
    Discussion Options set to:
    x - An administrator must approve the comment (regardless of any matches below)
    x - Comment author must fill out name and e-mail

    I am logged in as the admin (it even recognizes me :) and trying to post a test comment to a test post. Actually I can, but it puts it into the moderation queue.
    Is there a way that I can "auto-approve" my own comments?
    TIA

  2. Kafkaesqui

    Posted 9 years ago #

    You can do this by adding just a couple lines to wp-includes/functions-post.php. Look in this file for the function wp_new_comment() (around line 450).

    Just before this line in the function:

    $approved = apply_filters('pre_comment_approved', $approved);

    Add this:

    if ( 1 == $user_id )
    $approved = 1;

    Change the number matched against $user_id to the numeric ID of the account you wish to auto-approve.

    Note: back up source files you plan to edit, and comment your changes (so you can find them later).

  3. moshu
    Member
    Posted 9 years ago #

    Thanks Kafkaesqui!
    I'll try to implement it. Though I still have a (rhetoric?) question: since usually the user with id# 1 is the default admin created during the install - or am I wrong? - wouldn't be expected that the fix you provided was there "by default"???
    Just my 2 cents :)

  4. Kafkaesqui

    Posted 9 years ago #

    User ID 1 is pretty much always the "admin" acccount yes. Then again, not everyone uses it all the time (I myself have a secondary account for posting, etc), so one may want to change it in the bit of code I have above. Anyway, I hope your question wasn't rhetorical, considering I answered it. ;~)

    As to what's in the source by default, that's sort of up to the devs. Well, it's also up to us too, to make suggestions and offer up solutions. You never know.

  5. Lorelle
    Member
    Posted 9 years ago #

    Kaf, as an aside, is this info in the Codex? I haven't seen it and it is something that has irritated me in the past but I just let it slide. It's a good thing to add.

    Thanks!

  6. Kafkaesqui

    Posted 9 years ago #

    Personally I'm averse to recommending core source code changes as part of the "official" documentation. But if you can figure a good place to fit it in...

  7. Lorelle
    Member
    Posted 9 years ago #

    I know, but this is annoying - So make them change the source code....

    <small>who am I to demand such things....</small>

  8. Nick Momrik
    Member
    Posted 9 years ago #

    Something like this shouldn't be too hard to make into a plugin...I'll see what I can do.

  9. a_campbell
    Member
    Posted 9 years ago #

    I tried adding this code but it didn't seem to make any difference. I must have done something stupid I suppose but I can't think what.

  10. elfin
    Moderator
    Posted 9 years ago #

    don't know if you are still working on this MtDewVirus, but consider amending it slightly.

    rather than just using a user id, would it be possible to allow all 'logged in' members to post comments without them being moderated, and all the rest get held in the queue.

    It isn't quite the same as whitelisting, which is open to abuse, especially if it only checks on email address..

  11. elfin
    Moderator
    Posted 9 years ago #

    doh!
    Official Comments

    may well be what I suggested!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.