Is there any way to prevent moderators from removing comments on a post until the original poster has accepted an answer? I had a question with a long trail of comments that I was slowly working my way through. I left my desk for 5 minutes, and when I came back I found that the entire comment trail had been removed because, and I quote, "They were flagged as not constructive/obsolete". Shouldn't it be up to the person who asked the question to decide if the comments were constructive to them?

This kind of overzealous editing of posts really makes the site unfriendly.


The comments were deleted because a user flagged them, and a second user commented saying they should be removed. The question also received an automatic flag from the system for the number of comments it received.

Keep in mind that:

  • Comments aren't meant to evolve into a discussion
  • Comments are second class citizens

This means:

  • If there is somebody that asks you more information, you should write that information into the question, if it is relevant, or make any difference for who answers. For example, if somebody asks the Drupal version for which you are interested, you should edit the question, and report that; if somebody asks you what, e.g., dsm() returns, you should edit the question to add that information, rather than commenting with that information, as that is probably information that is useful to who answers. Who answers doesn't need to look for important information given in the 11th comment.
  • If somebody disagrees with what you are trying to do, and comments saying it, there isn't the need to start a debate about whose opinion is correct.

Looking at the specific case, there are 18 deleted comments; 9 of those comments where written by you, who also wrote the final three comments. Actually, there is a comment after yours, but that is the comment suggesting the comments should be, "cleaned up."

Your last 4 comments were the following ones. (I am writing them from the most recent to the older one.)

Yup, that did it. Thanks. OP updated to show working code.

I tried your drupal_set_message and got what I expected: on an actual session node, it displays a lovely array of the taxonomy term. On the view page, it tells me that 'node' is an undefined index. So maybe the entire thing needs to go inside a test to see if node->type exists.

It does exist when it's actually displaying a content type=session node on the session page template. The problem is when I'm using a page display for a view that contains sessions, it apparently thinks I'm displaying a session node, when I'm really not. What I need is some way to tell the function to run when displaying an individual node, but not a group of nodes in a view.

Not sure what you mean by that. I need to run the code on nodes that ARE content type=session; I just don't want it to display on the view page display that contains content type=session.

For the other comments, there is exactly one comment from a user followed by a comment from you; that at least leads me to think you read all the comments given by the users who replied you.

The rest of the comments are not constructive, in some way, as they don't give useful information to answer the question; they are just being a discussion about what said in a previous comment.

User A: The surrounding if should take care of what you are trying to accomplish, so I'd check and make sure this is the place you are getting your error message from. That, and you actually have == in there, not =.

You: Uh, it's supposed to be == - that is how php checks for equality. Single = is the assignment operator. And yes, this is the place I'm getting the error message from. It didn't occur until I added this function, and it goes away as soon as I comment it out.

User A: That's what I said. Make sure it's ==.

You: Sorry, my misunderstanding. You didn't actually say, "make sure", you said "you actually have". It sounded like you were telling me that I had == in there, which I obviously do.

User A: Sorry, I said 'make sure' in the previous sentence and continued that thought in my mind into the next. In any case, something is going wrong with your if logic there as it should only be executing when the node type is "session," so I'd look into what could be causing that. Perhaps drupal_set_message('<pre>' . print_r($vars['node'], TRUE) . '</pre>') or something similar will shed more light on the situation.

In such cases, comments are deleted (when flagged) exactly for stopping the discussion.

Keep in mind that Stack Exchange sites are not forums.
Stack Exchange sites follow a Q&A format, where comments are not used for discussion, but for short, in-point observations. If anything needs to be preserved, that should be written in an answer, or in the question, considering that a question should not contain its answer, and an answer should not ask for further information about the problem to resolve.

  • 2
    Also when a comment thread reaches a certain threshold, the option is displayed to move the conversation into chat - this is an option that clearly not enough people use (myself included). – Chapabu Jun 21 '12 at 11:33
  • 2
    Part of the reason I'm so annoyed by this, though, is that the moderator collated the comments and submitted them as his own answer. This means that the person who actually spent all that time helping me isn't able to get any credit for it. I can't contact him/her directly to let them know to post an answer, and because all the comments were removed, they'll no longer receive notification of changes to the post. That doesn't seem fair. – EmmyS Jun 21 '12 at 14:14
  • @EmmyS I didn't need to read the comments, to answer the question. As a matter of fact, all I did was writing a simple implementation of hook_preprocess_page() to verify if effectively the Views module was not setting $variables['node'], and checked the documentation of the Views module to see what its preprocess function would do. Also, I have not said who deleted the comments; the information I provided in my answer is available to each moderator. – kiamlaluno Jun 21 '12 at 14:33
  • 2
    @kiamlaluno - you may not have needed to read the comments, but you're missing my point - the person who was commenting along with me is the one who really pointed me in the right direction, and now there's no way to give him or her credit for that by reminding them to post an answer. – EmmyS Jun 21 '12 at 21:34
  • The answer I wrote didn't need any information you have given in comments. If he wanted to give an answer, he could have done it, but he didn't. Actually, he never pointed out that in a view listing nodes $variable['node'] is not a node object, which is the real reason why your code doesn't work; $variable['node'] is a node object when the viewed page is a node page. – kiamlaluno Jun 22 '12 at 8:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .