WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Comment Moderation Issue - need help (13 posts)

  1. housebg
    Member
    Posted 2 years ago #

    I have setup the comment moderation to require an admin to approve all comments. But if I am logged in as the author of a post, and make a comment on that post - it is getting automatically approved.

    This is for a specialized site, where we have users that are set with the Role of Contributor and assigned as authors to (1) unique custom post type, which acts as a business listing. They can then comment and interact with customers, and we highlight their comments as the author. But, they aren't allowed to solicit business away from the site, so we need to moderate their comments and make sure they aren't sneaking in website links or phone numbers and emails.

    Shouldn't setting the "An Administrator must always approve a comment" ensure that all comments have to be moderated? What could be overriding this?

    We were set to go live on Monday, and I did some last testing just to be safe and discovered this problem - so we're a little desperate.

  2. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    Try using the check box where it says 'Before a comment appears (check box here) An administrator must always approve the comment'.

  3. housebg
    Member
    Posted 2 years ago #

    I did that, that's why I'm confused. If the author of the post is logged in and comments, it's completely bypassing this requirement.
    I looked in comment.php, and that is the first check so it should be returning false and not allowing the comment to go live. But it isn't being moderated.

    Other comments from visitors that are not the author get moderated.

    What in the world could be causing this?

  4. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    Try resetting the author's role as contributor or editor and see what happens.

  5. housebg
    Member
    Posted 2 years ago #

    Thanks Krishna for trying to help. These users as Contributors as their Role. We set them as the author on the post in the admin, but they are still contributors.

    Mostly, I'm looking to understand why the "An Administrator must always approve the comment" does ALWAYS work. Is there a loophole here?

  6. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    No, it is not a loophole, but how you restrict or allow certain things.

    However, glad to see that you resolved the problem.

  7. housebg
    Member
    Posted 2 years ago #

    Actually, it's not resolved at all - sorry if I gave that impression.

    Here's what we have...
    1 Administrator, which is me as the developer
    1 Editor, which is the site owner
    up to 60 Contributors. These are the business owners that have one of these listings on the site.

    I use a combination of Adminimize and custom code functions to limit who has access to what.

    I had this working before, and when one of the business owners logged in and made a comment, it was being moderated. I'm not sure what changed, and unsure how it could change from my reading. The "must always approve" is where I'm stumbling...

    Is it "the administrator must always approved - unless it's one of these conditions that's built into WordPress that you may not know about" :-)

    All joking aside - always means always to me - so why are these comments being sent through instead of held in moderation? Again, it's logged in users - not guests. Does logging in bypass the "adminstrator must always approve"? If it does, how do I change this functionality? Is there a filter I can use to make always = ALWAYS ?

  8. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    Perhaps this helps: http://codex.wordpress.org/Settings_Discussion_SubPanel

    Also note that your custom settings can override some of the settings, or can cause setting conflicts that cause problems.

  9. housebg
    Member
    Posted 2 years ago #

    Appreciate the link, but I was already over there double-checking role capabilities. I understand that customization can cause problems - what I'm looking for here is an explanation of what circumstances can case the "ALWAYS" to be overridden.

    If someone can tell me when always gets bypassed, then I can start going through code and various plugins to see what's mucky up the process. But the codex says this is ALWAYS, and the code in comment.php is pretty specific to check for this flag first and then break out.

    It would seem, therefore, that every comment would be held for moderation - but it's not. So I need to understand when this always can be overrulled - what kinds of circumstances, etc. Otherwise, I'm shooting in the dark here without any kind of idea where the problem could be.

    Make sense?

  10. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    Yes. But I think you need to have a look at wp-comments-post too where the conditions are set, for instance, if the user is logged in, etc.

  11. housebg
    Member
    Posted 2 years ago #

    I'm getting closer, but still stumped. If the logged in contributor comments on a post that they are NOT the author of, the comment goes into moderation like it should.

    But if they comment on their own post - it's automatically approved.

    I there a filter or function I can use to stop that behavior and make their comments be moderated, even if they are author of the post?

  12. housebg
    Member
    Posted 2 years ago #

    Okay, I solved it - so I'm going to document in case anyone else has this problem.

    There is a pre_comment_approved filter, so I used that to add a function that forces every comment to be moderated, including ones that the author of a post makes on their own post.

    add_filter('pre_comment_approved', 'xko_pre_comment_approved', null, 2);
    function xko_pre_comment_approved($approved, $commentdata)
    {
        $approved = 0;
    
      return $approved;
    }
  13. ntoqiakt
    Member
    Posted 1 year ago #

    Housebg, you're my hero! :-)

    I spent quite a while searching for a solution for this and I posted question here but never got a reply.

    Anyways, thanks for doing the hard work! I just tried it on a website I'm developing for a school it works great!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.