We've had a lot of these recently, even a few today. I'll get straight to the point:

It's my opinion that any question that simply requests we write code for the asker, and that shows zero research effort, should be unilaterally put on hold (with a friendly request to post the code); whether that be by a single moderator, a band of 3k+ community members, or a combination.

Such questions are not considered appropriate on any Stack Exchange site that I've ever visited, and I believe we need to actively discourage them. For example, one of the custom close reasons on Stack Overflow is:

Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results.

I don't see any reason for us not to use the same logic here, with questions that relate to code.

So what I'm asking is does any community member object to these questions being closed unilaterally?

If so, I'd be grateful if you could outline your reasons for the objection in your answer. I can't conceive of a valid reason to keep these questions open so if anyone disagrees I'd be genuinely interested in the thinking behind that opinion. There may well also be edge cases I've missed, which would be great to know about, but I'm confident we can still implement an overall policy while treating any edge cases with the respect they need.

If this question is well received (as in, the community want these types of questions to be closed), I propose that the above quoted close reason from Stack Overflow, or something very similar, become our first custom close reason. This would help to facilitate the closing of such questions quickly and easily, with an official reference to point to.

If it's not well received then at least we've made a conscious group decision to allow those kinds of questions, and we've got this meta post to provide as a reference if anyone wants to query it.


4 Answers 4


So long as shows zero research effort is the main point, I have no issue at all with code requests being closed.

  • +1. Drupal Docs/Google is there for a reason ;-)
    – Chapabu
    Aug 19, 2013 at 9:04
  • 2
    To make it less vague, I'd say that "at least one version of code and description how it failed or where and why OP got stuck, with link to docs if applicable" should count as minimal research effort.
    – Mołot
    Aug 20, 2013 at 10:40
  • I think you've hit the nail on the head there @PatrickKenny
    – Clive Mod
    Aug 22, 2013 at 18:56

OK so we seem to have a reasonably strong consensus (as strong as our meta crowd will normally get anyway ;), but I have to confess I'm softening a bit on the idea.

I don't think we necessarily need a blanket ban on code-request questions. Anything egregiously offensive by way of such a request would almost always fall into the "not enough research effort" bracket anyway, as PatrickKenny has already alluded to.

What struck me is that questions that show research effort in some way, that don't happen to ask for a code solution, but got one, would make a mockery of the whole thing. And (in my head anyway) that meant the 'thing' must be a daft idea.

I reckon that as long as the OP has asked an otherwise good quality question we don't need to penalise them for asking for code. By good quality I mean described well (or at least coherently), showing at least some sort of attempt to research/solve the problem themselves, But not requiring that code be shown.

Code will of course often be vital to solving a lot of problems, but we can use comments as normal to nudge OPs into that if they don't already provide it. And if questions sit around for ages without that vital code being added, they can be dealt with as needed.

So, to in fact back out on my proposal pretty much completely, I don't think we need such a harsh custom close reason. We can measure the quality of questions in other ways, and at the same time make this place an even better code-snippet repository for Drupal.

More thoughts?

  • 1
    I'm with Clive on this. We should be focusing on good questions vs bad questions, and not the anticipated solution. I would prefer that the community casts more close votes and/or downvotes on what they consider bad questions, and go from there.
    – mpdonadio Mod
    Aug 22, 2013 at 21:03
  • If question is asking for solution, we shouldn't require code. If it plainly asks for code, code sample should be required.
    – Mołot
    Aug 23, 2013 at 9:09

Time to pull my point of view from comments:

It all depends on what OP asks for.

  • For questions plainly asking for code, at least one version of code and description how it failed or where and why OP got stuck, with error messages and link to docs if applicable should be required.

  • If OP asks for a solution to a problem, description how he tried to solve it and how it failed him should be enough, no matter if it was done with code, modules from Drupal.org or any other way.

I'm pretty sure both cases can be summarized with one message, probably inside "Minimal research effort" message or in Help Center.


I don't think it should be closed automatically - the OP should first be reminded to add code, what they attempted, etc, and the question flagged. If the OP doesn't edit the question or add a comment within a given time period (a week or month, for example) then it will be closed automatically.

  • 2
    It wouldn't be closed automatically, it would be put on hold for 5 days to give OP time to do just that: add code, describe what he attempted, etc. And if he will not, then it'll get closed. That's why on hold status was introduced. See this post and posts linked from answers.
    – Mołot
    Aug 20, 2013 at 13:51
  • 1
    It's not about closing automatically, there'll still need to be human intervention in any case. As @Mołot said that's why we now put questions "on hold", and they don't convert to "closed" until the time period that you're suggesting is up (1 week as it happens). So we've got that part of it covered. The "on hold" reason, plus any comments we'd leave, would serve to the let the OP know exactly what they need to do to get the question re-opened. With that knowledge in mind, does your stance change at all?
    – Clive Mod
    Aug 20, 2013 at 14:05
  • 1
    no, I agree with you Aug 20, 2013 at 19:03

You must log in to answer this question.

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